From 5923d869aa8baa7ed4f5fdbf8052d7a6a5bbc9fe Mon Sep 17 00:00:00 2001 From: r888888888 Date: Thu, 18 Jun 2015 12:29:24 -0700 Subject: [PATCH] include mods+admins in janitor report for comparison --- app/logical/reports/janitor_trials.rb | 12 ++++++------ app/views/reports/janitor_trials.html.erb | 4 ++-- app/views/reports/user_promotions.html.erb | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/logical/reports/janitor_trials.rb b/app/logical/reports/janitor_trials.rb index a23afa994..26c69e1e7 100644 --- a/app/logical/reports/janitor_trials.rb +++ b/app/logical/reports/janitor_trials.rb @@ -1,14 +1,14 @@ module Reports class JanitorTrials class Janitor - attr_reader :trial + attr_reader :user - def initialize(trial) - @trial = trial + def initialize(user) + @user = user end - def user - trial.user + def trial + JanitorTrial.where(user_id: user.id).first end def since @@ -39,7 +39,7 @@ module Reports end def janitors - JanitorTrial.where(status: "active").to_a.map {|x| Janitor.new(x)} + User.where("level >= ?", User::Levels::JANITOR).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 index b70b5f2e2..0077ce2fa 100644 --- a/app/views/reports/janitor_trials.html.erb +++ b/app/views/reports/janitor_trials.html.erb @@ -2,7 +2,7 @@

Janitor Trial Report

-

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.

+

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.

@@ -29,7 +29,7 @@
<%= janitor.percentile_50_score %> <%= number_to_percentage janitor.confidence_interval, :precision => 0 %> - <% if CurrentUser.user.is_moderator? %> + <% if CurrentUser.user.is_moderator? && janitor.trial %> <%= 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 %> diff --git a/app/views/reports/user_promotions.html.erb b/app/views/reports/user_promotions.html.erb index 7ce132b56..3e8c7be2f 100644 --- a/app/views/reports/user_promotions.html.erb +++ b/app/views/reports/user_promotions.html.erb @@ -2,7 +2,7 @@

User Promotion Confidence Intervals

-

Binomial proportion confidence interval for how likely a user's uploads will achieve a score of at at least n with 95% confidence within the past 30 days.

+

Binomial proportion confidence interval for how likely a user's uploads will achieve a score of at at least n with 95% confidence within the past 30 days. Most statistics are not significant unless there are at least 300 uploads.