add deletion column to promotion report
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
1
config/initializers/assets.rb
Normal file
1
config/initializers/assets.rb
Normal file
@@ -0,0 +1 @@
|
||||
Rails.application.config.assets.precompile += %w( stupidtable.js )
|
||||
Reference in New Issue
Block a user