add deletion column to promotion report

This commit is contained in:
r888888888
2014-07-01 15:06:19 -07:00
parent bc912ecd00
commit e86c8ceb2a
3 changed files with 13 additions and 0 deletions

View File

@@ -13,6 +13,10 @@ module Reports
def confidence_interval_for(n)
Reports::UserPromotions.confidence_interval_for(user, n)
end
def deletion_confidence_interval
Reports::UserPromotions.deletion_confidence_interval(user)
end
end
def self.confidence_interval_for(user, n)
@@ -21,6 +25,12 @@ module Reports
ci_lower_bound(up_votes, total_votes, 0.95)
end
def self.deletion_confidence_interval_for(user)
deletions = Post.where(:uploader_id => user.id, :is_deleted => true).count
total = Post.where(:uploader_id => user.id).count
ci_lower_bound(deletions, total, 0.95)
end
def self.ci_lower_bound(pos, n, confidence)
if n == 0
return 0