mysociety/alaveteli

View on GitHub
app/views/admin_general/stats.html.erb

Summary

Maintainability
Test Coverage
<% @title = 'Statistics' %>

<div class="hero-unit">
  <h2>
    <%= number_with_delimiter(@public_body_count) %> public authorities
  </h2>

  <h2>
    <%= number_with_delimiter(@info_request_count) %> requests,
    <%= number_with_delimiter(@outgoing_message_count) %> outgoing messages,
    <%= number_with_delimiter(@incoming_message_count) %> incoming messages
  </h2>

  <h2>
    <%= number_with_delimiter(@user_count) %> users,
    <%= number_with_delimiter(@track_thing_count) %> tracked things
  </h2>

  <h2>
    <%= number_with_delimiter(@comment_count) %> annotations
  </h2>
</div>

<div class="row">
  <div class="span12">
    <h1>Statistics</h1>
    <h2>Chart of requests (excluding backpaged)</h2>
    <% if File.exist?(File.expand_path("public/foi-live-creation.png", Rails.root)) %>
      <img src="/foi-live-creation.png" alt="Chart of requests">
    <% else %>
      No requests yet (the raw data may include the Holding Pen request)
    <% end %>
  </div>
</div>
<div class="row">
  <div class="span12">
    <h2>State of requests (includes backpaged)</h2>
    <div class="container">
      <% for state, count in @request_by_state %>
        <div class="row stats-row">
          <div class="span1">
            <span class="label label-info">
              <%= number_with_delimiter(count) %>
            </span>
          </div>
          <div class="span4">
            <%=state%>
          </div>
        </div>
      <% end %>
    </div>
  </div>
</div>
<div class="row">
  <div class="span12">
    <h2>Chart of users</h2>
    <% if File.exist?(File.expand_path("public/foi-user-use.png", Rails.root)) %>
      <img src="/foi-user-use.png" alt="Chart of users">
    <% else %>
      No user data yet
    <% end %>
  </div>
</div>
<div class="row">
  <div class="span12">
    <h2>Tracks by type</h2>
    <div class="container">
      <% for state, count in @tracks_by_type %>
        <div class="row stats-row">
          <div class="span1">
            <span class="label label-info">
              <%= number_with_delimiter(count) %>
            </span>
          </div>
          <div class="span4">
            <%=state%>
          </div>
        </div>
      <% end %>
    </div>
  </div>
</div>