app/views/stats/category_report.html.erb

Summary

Maintainability
Test Coverage
<% content_for :script do %><%= javascript_include_tag "highcharts" %><% end %>

<div>
  <h2>Statistik nach Kategorie</h2>
  <ul class="button-group">
    <li><%=link_to "3 Monate",    stat_category_report_path(range: 91 ), class: :button %></li>
    <li><%=link_to "150 Tage",    stat_category_report_path(range: 150), class: :button %></li>
    <li><%=link_to "halbes Jahr", stat_category_report_path(range: 182), class: :button %></li>
    <li><%=link_to "Jahr",        stat_category_report_path(range: 365), class: :button %></li>
    <li><%=link_to "Alles",        stat_category_report_path(range: 999999999999999), class: :button %></li>
  </ul>

  <br/>
  Es werden nur Antworten innerhalb der letzten <%=@range%> Tage berücksichtigt.
</div>

<% attr = { ajax: 1, "extract-selector" => "#graphs",  "target-selector" => "#usestats" } %>
<div>
  <style scoped>
    th:first-child, td:first-child, td:last-child { text-align: left }
    td, th { text-align: right }
  </style>
  <table>
    <tr><th>Kategorie</th><th>Beide</th><th>Mit Account</th><th>Ohne Account</th><th></th></tr>
    <% @keys.each do |cat, d| %>
      <tr>
        <td><%=cat%></td>
        <td><%=d[:all]%></td>
        <td><%=d[:registered]%></td>
        <td><%=d[:unregistered]%></td>
        <% url = stat_activity_report_path(questions: d[:questions].join("_"), range: @range) %>
        <td><%=link_to "Nutzungsstatistik für #{cat}", url, data: attr %></td>
      </tr>
    <% end %>
  </table>

  <%=link_to "Nutzungsstatistik für alle Kategorien anzeigen", stat_activity_report_path, data: attr %>
</div>

<div>
  <h3>Nutzungsstatistik</h2>
  <div id="usestats">Bitte wähle oben aus, für welche Kategorie die Statistik angezeigt werden soll</div>
</div>