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

View File

@@ -13,6 +13,7 @@
<th data-sort="string">Age</th>
<th data-sort="int">score:3+</th>
<th data-sort="int">score:6+</th>
<th data-sort="int">deletion</th>
</tr>
</thead>
<tbody>
@@ -26,6 +27,7 @@
<td data-sort-value="<%= user.created_at.to_formatted_s(:db) %>"><%= time_ago_in_words user.created_at %></td>
<td><%= number_to_percentage user.confidence_interval_for(3), :precision => 0 %></td>
<td><%= number_to_percentage user.confidence_interval_for(6), :precision => 0 %></td>
<td><%= number_to_percentage user.deletion_confidence_interval, :precision => 0 %></td>
</tr>
<% end %>
<% end %>

View File

@@ -0,0 +1 @@
Rails.application.config.assets.precompile += %w( stupidtable.js )