<h1>Moderator Report For <%= Date.today %></h1>

<table width="100%">
  <thead>
    <tr>
      <th width="15%" style="text-align: left;">Name</th>
      <th width="10%" style="text-align: left;">Level</th>
      <th width="10%" style="text-align: right;" title="Number of posts approved in past seven days">Appr 7</th>
      <th width="10%" style="text-align: right;" title="Number of posts approved in past fourteen days">Appr 14</th>
      <th width="10%" style="text-align: right;" title="Number of comments posted in past seven days">Comm</th>
      <th width="10%" style="text-align: right;" title="Number of forum posts posted in past seven days">Forum</th>
      <th width="35%"></th>
    </tr>
  </thead>
  <tbody>
    <% User.where("level >= ?", CONFIG["user_levels"]["Janitor"]).order("level, name").find_each do |user| %>
      <tr>
        <td><%= h user.name %></td>
        <td><%= h user.pretty_level %></td>
        <td style="text-align: right;"><%= Post.where(:approver_id => user.id).where("created_at >= ?", 7.days.ago).count %>/<%= Post.where("created_at >= ? AND (approver_id IS NOT NULL OR status = 'pending')", 7.days.ago).count %></td>
        <td style="text-align: right;"><%= Post.where(:approver_id => user.id).where("created_at >= ?", 14.days.ago).count %>/<%= Post.where("created_at >= ? AND (approver_id IS NOT NULL OR status = 'pending')", 14.days.ago).count %></td>
        <td style="text-align: right;"><%= Comment.where(:user_id => user.id).where("created_at >= ?", 7.days.ago).count %></td>
        <td style="text-align: right;"><%= ForumPost.where(:creator_id => user.id).where("created_at >= ?", 7.days.ago).count %></td>
        <td></td>
      </tr>
    <% end %>
  </tbody>
</table>
