report negative score chance on janitor trial report

This commit is contained in:
r888888888
2015-08-20 14:23:45 -07:00
parent d44dd09a88
commit e06d8a3cc7
2 changed files with 11 additions and 3 deletions

View File

@@ -27,11 +27,17 @@ 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 deletion_confidence
def deletion_chance
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).to_i
end
def neg_score_chance
hits = Post.where("approver_id = ? and created_at >= ? and score < 0", 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).to_i
end
end
def janitors

View File

@@ -11,6 +11,7 @@
<th data-sort="int">Level</th>
<th data-sort="int">Approvals</th>
<th data-sort="int">Del Chance</th>
<th data-sort="int">Neg Score 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></th>
@@ -22,11 +23,12 @@
<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.deletion_confidence, posts_path(:tags => "approver:#{janitor.user.name} status:deleted", :limit => 200) %></td>
<td><%= link_to janitor.deletion_chance, posts_path(:tags => "approver:#{janitor.user.name} status:deleted", :limit => 200) %></td>
<td><%= link_to janitor.neg_score_chance, posts_path(:tags => "approver:#{janitor.user.name} score:<0", :limit => 200) %></td>
<td><%= janitor.percentile_25_score %></td>
<td><%= janitor.percentile_50_score %></td>
<td>
<% if CurrentUser.user.is_moderator? && janitor.trial %>
<% if CurrentUser.user.is_moderator? && janitor.trial && janitor.trial.active? %>
<%= link_to "Promote", promote_janitor_trial_path(janitor.trial), :method => :put, :remote => true %>
| <%= link_to "Demote", demote_janitor_trial_path(janitor.trial), :method => :put, :remote => true %>
<% end %>