From e06d8a3cc782437e260f9981fcf30d31d14fabe5 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Thu, 20 Aug 2015 14:23:45 -0700 Subject: [PATCH] report negative score chance on janitor trial report --- app/logical/reports/janitor_trials.rb | 8 +++++++- app/views/reports/janitor_trials.html.erb | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/logical/reports/janitor_trials.rb b/app/logical/reports/janitor_trials.rb index be76d415a..0c261fe2c 100644 --- a/app/logical/reports/janitor_trials.rb +++ b/app/logical/reports/janitor_trials.rb @@ -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 diff --git a/app/views/reports/janitor_trials.html.erb b/app/views/reports/janitor_trials.html.erb index d01d9f894..bdc893cf2 100644 --- a/app/views/reports/janitor_trials.html.erb +++ b/app/views/reports/janitor_trials.html.erb @@ -11,6 +11,7 @@ Level Approvals Del Chance + Neg Score Chance Quartile Score Median Score @@ -22,11 +23,12 @@ <%= link_to_user janitor.user %> <%= janitor.user.level_string %> <%= link_to janitor.approval_count, posts_path(:tags => "approver:#{janitor.user.name} order:random", :limit => 200) %> - <%= link_to janitor.deletion_confidence, posts_path(:tags => "approver:#{janitor.user.name} status:deleted", :limit => 200) %> + <%= link_to janitor.deletion_chance, posts_path(:tags => "approver:#{janitor.user.name} status:deleted", :limit => 200) %> + <%= link_to janitor.neg_score_chance, posts_path(:tags => "approver:#{janitor.user.name} score:<0", :limit => 200) %> <%= janitor.percentile_25_score %> <%= janitor.percentile_50_score %> - <% 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 %>