diff --git a/app/logical/reports/janitor_trials.rb b/app/logical/reports/janitor_trials.rb
index 0c261fe2c..0c262d74e 100644
--- a/app/logical/reports/janitor_trials.rb
+++ b/app/logical/reports/janitor_trials.rb
@@ -11,6 +11,10 @@ module Reports
JanitorTrial.where(user_id: user.id).first
end
+ def created_at
+ trial.created_at
+ end
+
def since
3.months.ago
end
diff --git a/app/logical/reports/user_promotions.rb b/app/logical/reports/user_promotions.rb
index 756f2b950..4f0d66aeb 100644
--- a/app/logical/reports/user_promotions.rb
+++ b/app/logical/reports/user_promotions.rb
@@ -18,6 +18,10 @@ module Reports
Reports::UserPromotions.deletion_confidence_interval_for(user)
end
+ def negative_score_confidence_interval
+ Reports::UserPromotions.negative_score_confidence_interval_for(user)
+ end
+
def median_score
ActiveRecord::Base.select_value_sql("select percentile_cont(0.50) within group (order by score) from posts where created_at >= ? and uploader_id = ?", ::Reports::UserPromotions.min_time, user.id).to_i
end
@@ -40,6 +44,13 @@ module Reports
ci_lower_bound(deletions, total)
end
+ def self.negative_score_confidence_interval_for(user, days = nil)
+ date = (days || 30).days.ago
+ hits = Post.where("created_at >= ? and score < 0", date).where(:uploader_id => user.id).count
+ total = Post.where("created_at >= ?", date).where(:uploader_id => user.id).count
+ ci_lower_bound(hits, total)
+ end
+
def self.ci_lower_bound(pos, n, confidence = 0.95)
if n == 0
return 0
diff --git a/app/views/janitor_trials/index.html.erb b/app/views/janitor_trials/index.html.erb
index aab9b0b3a..e37158688 100644
--- a/app/views/janitor_trials/index.html.erb
+++ b/app/views/janitor_trials/index.html.erb
@@ -6,7 +6,7 @@
diff --git a/app/views/reports/contributors.html.erb b/app/views/reports/contributors.html.erb
index ca95cb838..104e12ece 100644
--- a/app/views/reports/contributors.html.erb
+++ b/app/views/reports/contributors.html.erb
@@ -10,7 +10,8 @@
User
- Duration
+ Date