<!doctype html>
<html>
<body>
<h1>Moderator Report For <%= Date.today %></h1>

<div style="margin-bottom: 2em;">
<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 day">Appr 1</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="35%" style="text-align: right;" title="Number of forum posts posted in past seven days">Forum</th>
    </tr>
  </thead>
  <tbody>
    <% User.find(:all, :conditions => ["level >= ?", CONFIG["user_levels"]["Test Janitor"]], :order => "level, name").each do |user| %>
      <tr>
        <td><%= link_to user.name, user_path(user, :host => Danbooru.config.hostname, :only_path => false) %></td>
        <td><%= user.pretty_level %></td>
        <td style="text-align: right;"><%= Post.count(:conditions => ["created_at >= ? AND approver_id = ?", 1.days.ago, user.id]) %>/<%= Post.count(:conditions => ["created_at >= ? AND (approver_id IS NOT NULL OR status = 'pending')", 1.days.ago]) %></td>
        <td style="text-align: right;"><%= Post.count(:conditions => ["created_at >= ? AND approver_id = ?", 7.days.ago, user.id]) %>/<%= Post.count(:conditions => ["created_at >= ? AND (approver_id IS NOT NULL OR status = 'pending')", 7.days.ago]) %></td>
        <td style="text-align: right;"><%= Post.count(:conditions => ["created_at >= ? AND approver_id = ?", 14.days.ago, user.id]) %>/<%= Post.count(:conditions => ["created_at >= ? AND (approver_id IS NOT NULL OR status = 'pending')", 14.days.ago]) %></td>
        <td style="text-align: right;"><%= Comment.count(:conditions => ["created_at >= ? AND user_id = ?", 7.days.ago, user.id]) %></td>
        <td style="text-align: right;"><%= ForumPost.count(:conditions => ["created_at >= ? AND creator_id = ?", 7.days.ago, user.id]) %></td>
      </tr>
    <% end %>
  </tbody>
</table>
</div>
</body>
</html>
