improve janitor/promotion reports, fix bug with forum post counts
This commit is contained in:
@@ -31,16 +31,10 @@ 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 rating_e_percentage
|
||||
100 * Post.where("approver_id = ? and created_at >= ? and rating = 'e'", user.id, since).count.to_f / [approval_count, 1].max
|
||||
end
|
||||
|
||||
def rating_q_percentage
|
||||
100 * Post.where("approver_id = ? and created_at >= ? and rating = 'q'", user.id, since).count.to_f / [approval_count, 1].max
|
||||
end
|
||||
|
||||
def rating_s_percentage
|
||||
100 * Post.where("approver_id = ? and created_at >= ? and rating = 's'", user.id, since).count.to_f / [approval_count, 1].max
|
||||
def confidence_interval
|
||||
hits = Post.where("approver_id = ? and created_at >= ? and score >= 3", 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)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ module Reports
|
||||
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 = ?", 30.days.ago, user.id).to_i
|
||||
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
|
||||
|
||||
def quartile_score
|
||||
ActiveRecord::Base.select_value_sql("select percentile_cont(0.25) within group (order by score) from posts where created_at >= ? and uploader_id = ?", 30.days.ago, user.id).to_i
|
||||
ActiveRecord::Base.select_value_sql("select percentile_cont(0.25) within group (order by score) from posts where created_at >= ? and uploader_id = ?", ::Reports::UserPromotions.min_time, user.id).to_i
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user