diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 87fbd5662..ebffe9985 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -3,10 +3,6 @@ class ReportsController < ApplicationController before_filter :gold_only, :only => [:similar_users] before_filter :moderator_only, :only => [:post_versions, :post_versions_create] - def janitor_trials - @report = Reports::JanitorTrials.new - end - def contributors @report = Reports::Contributors.new end diff --git a/app/logical/reports/janitor_trials.rb b/app/logical/reports/janitor_trials.rb deleted file mode 100644 index 68ef2709d..000000000 --- a/app/logical/reports/janitor_trials.rb +++ /dev/null @@ -1,51 +0,0 @@ -module Reports - class JanitorTrials - class Janitor - attr_reader :user - - def initialize(user) - @user = user - end - - def trial - JanitorTrial.where(user_id: user.id).first - end - - def created_at - trial.try(:created_at) || 10.years.ago - end - - def since - 3.months.ago - end - - def approval_count - @approval_count ||= Post.where("approver_id = ? and created_at >= ?", 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 - - def percentile_50_score - 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_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 - User.where("bit_prefs & ? > 0", User.flag_value_for("can_approve_posts")).to_a.map {|x| Janitor.new(x)} - end - end -end diff --git a/app/views/reports/janitor_trials.html.erb b/app/views/reports/janitor_trials.html.erb deleted file mode 100644 index ef8526064..000000000 --- a/app/views/reports/janitor_trials.html.erb +++ /dev/null @@ -1,58 +0,0 @@ -
All numbers shown are for the past 3 months. Binomial proportion confidence interval for how likely a janitor's approvals will achieve a score of at at least n with 95% confidence. Most statistics are not significant unless there are at least 300 approvals.
- -| User | -Age | -Level | -Approvals | -Del Chance | -Neg Score Chance | -Quartile Score | -Median Score | -- |
|---|---|---|---|---|---|---|---|---|
| <%= link_to_user janitor.user %> | -<%= time_ago_in_words(janitor.created_at) %> | -<%= janitor.user.level_string %> | -<%= link_to janitor.approval_count, posts_path(:tags => "approver:#{janitor.user.name} order:random", :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 && 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 %> - | -