revise janitor trial report

This commit is contained in:
r888888888
2015-08-20 14:11:46 -07:00
parent ba04068bfc
commit d44dd09a88
2 changed files with 5 additions and 11 deletions

View File

@@ -19,10 +19,6 @@ module Reports
@approval_count ||= Post.where("approver_id = ? and created_at >= ?", user.id, since).count
end
def deleted_count
Post.where("approver_id = ? and created_at >= ? and is_deleted = true", user.id, since).count
end
def percentile_25_score
ActiveRecord::Base.select_value_sql("select percentile_cont(0.25) within group (order by score) from posts where created_at >= ? and approver_id = ?", since, user.id).to_i
end
@@ -31,10 +27,10 @@ module Reports
ActiveRecord::Base.select_value_sql("select percentile_cont(0.50) within group (order by score) from posts where created_at >= ? and approver_id = ?", since, user.id).to_i
end
def confidence_interval
hits = Post.where("approver_id = ? and created_at >= ? and score >= 3", user.id, since).count
def deletion_confidence
hits = Post.where("approver_id = ? and created_at >= ? and is_deleted = true", user.id, since).count
total = Post.where("approver_id = ? and created_at >= ?", user.id, since).count
Reports::UserPromotions.ci_lower_bound(hits, total, 0.95)
Reports::UserPromotions.ci_lower_bound(hits, total, 0.95).to_i
end
end

View File

@@ -10,10 +10,9 @@
<th data-sort="string">User</th>
<th data-sort="int">Level</th>
<th data-sort="int">Approvals</th>
<th data-sort="int">Deleted</th>
<th data-sort="int">Del Chance</th>
<th data-sort="int" title="25% of approvals received this score or less">Quartile Score</th>
<th data-sort="int" title="50% of approvals received this score or less">Median Score</th>
<th data-sort="int" title="Likelihood an approval will get a score of 3 or higher">score:3+</th>
<th></th>
</tr>
</thead>
@@ -23,10 +22,9 @@
<td><%= link_to_user janitor.user %></td>
<td data-sort-value="<%= janitor.user.level %>"><%= janitor.user.level_string %></td>
<td><%= link_to janitor.approval_count, posts_path(:tags => "approver:#{janitor.user.name} order:random", :limit => 200) %></td>
<td><%= link_to janitor.deleted_count, posts_path(:tags => "approver:#{janitor.user.name} status:deleted", :limit => 200) %></td>
<td><%= link_to janitor.deletion_confidence, posts_path(:tags => "approver:#{janitor.user.name} status:deleted", :limit => 200) %></td>
<td><%= janitor.percentile_25_score %></td>
<td><%= janitor.percentile_50_score %></td>
<td><%= number_to_percentage janitor.confidence_interval, :precision => 0 %></td>
<td>
<% if CurrentUser.user.is_moderator? && janitor.trial %>
<%= link_to "Promote", promote_janitor_trial_path(janitor.trial), :method => :put, :remote => true %>