fixes #2517: Janitor trial report broken
This commit is contained in:
@@ -11,6 +11,10 @@ module Reports
|
|||||||
JanitorTrial.where(user_id: user.id).first
|
JanitorTrial.where(user_id: user.id).first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def created_at
|
||||||
|
trial.created_at
|
||||||
|
end
|
||||||
|
|
||||||
def since
|
def since
|
||||||
3.months.ago
|
3.months.ago
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ module Reports
|
|||||||
Reports::UserPromotions.deletion_confidence_interval_for(user)
|
Reports::UserPromotions.deletion_confidence_interval_for(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def negative_score_confidence_interval
|
||||||
|
Reports::UserPromotions.negative_score_confidence_interval_for(user)
|
||||||
|
end
|
||||||
|
|
||||||
def median_score
|
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
|
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
|
end
|
||||||
@@ -40,6 +44,13 @@ module Reports
|
|||||||
ci_lower_bound(deletions, total)
|
ci_lower_bound(deletions, total)
|
||||||
end
|
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)
|
def self.ci_lower_bound(pos, n, confidence = 0.95)
|
||||||
if n == 0
|
if n == 0
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>User</th>
|
<th>User</th>
|
||||||
<th>Duration</th>
|
<th>Date</th>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
<th data-sort="string">User</th>
|
<th data-sort="string">User</th>
|
||||||
<th data-sort="int">Level</th>
|
<th data-sort="int">Level</th>
|
||||||
<th data-sort="int">Uploads</th>
|
<th data-sort="int">Uploads</th>
|
||||||
<th data-sort="int">deletion</th>
|
<th data-sort="int">Del Chance</th>
|
||||||
|
<th data-sort="int">Neg Score Chance</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -19,8 +20,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><%= link_to_user user.user %></td>
|
<td><%= link_to_user user.user %></td>
|
||||||
<td data-sort-value="<%= user.level %>"><%= user.level_string %></td>
|
<td data-sort-value="<%= user.level %>"><%= user.level_string %></td>
|
||||||
<td><%= link_to user.post_upload_count, posts_path(:tags => "uploader:#{user.name} order:random", :limit => 200) %></td>
|
<td><%= link_to user.post_upload_count, posts_path(:tags => "user:#{user.name} order:random", :limit => 200) %></td>
|
||||||
<td><%= link_to number_to_percentage(user.deletion_confidence_interval, :precision => 0), posts_path(:tags => "uploader:#{user.name} status:deleted", :limit => 200) %></td>
|
<td><%= link_to number_to_percentage(user.deletion_confidence_interval, :precision => 0), posts_path(:tags => "user:#{user.name} status:deleted", :limit => 200) %></td>
|
||||||
|
<td><%= link_to number_to_percentage(user.negative_score_confidence_interval, :precision => 0), posts_path(:tags => "user:#{user.name} score:<0", :limit => 200) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -11,11 +11,9 @@
|
|||||||
<th data-sort="int">Level</th>
|
<th data-sort="int">Level</th>
|
||||||
<th data-sort="int">Uploads</th>
|
<th data-sort="int">Uploads</th>
|
||||||
<th data-sort="string">Age</th>
|
<th data-sort="string">Age</th>
|
||||||
<th data-sort="int">score:3+</th>
|
<th data-sort="int">Del Chance</th>
|
||||||
<th data-sort="int" title="25% of uploads received this score or less">quartile score</th>
|
<th data-sort="int">Neg Score Chance</th>
|
||||||
<th data-sort="int" title="50% of uploads received this score or less">median score</th>
|
<th data-sort="int">Limit</th>
|
||||||
<th data-sort="int">deletion</th>
|
|
||||||
<th data-sort="int">limit</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -24,12 +22,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><%= link_to_user user.user %></td>
|
<td><%= link_to_user user.user %></td>
|
||||||
<td data-sort-value="<%= user.level %>"><%= user.level_string %></td>
|
<td data-sort-value="<%= user.level %>"><%= user.level_string %></td>
|
||||||
<td><%= link_to user.post_upload_count, posts_path(:tags => "uploader:#{user.name} order:random", :limit => 200) %></td>
|
<td><%= link_to user.post_upload_count, posts_path(:tags => "user:#{user.name} order:random", :limit => 200) %></td>
|
||||||
<td data-sort-value="<%= user.created_at.to_formatted_s(:db) %>"><%= time_ago_in_words user.created_at %></td>
|
<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><%= link_to number_to_percentage(user.deletion_confidence_interval, :precision => 0), posts_path(:tags => "user:#{user.name} status:deleted", :limit => 200) %></td>
|
||||||
<td><%= user.quartile_score %></td>
|
<td><%= link_to number_to_percentage(user.negative_score_confidence_interval, :precision => 0), posts_path(:tags => "user:#{user.name} score:<0", :limit => 200) %></td>
|
||||||
<td><%= user.median_score %></td>
|
|
||||||
<td><%= link_to number_to_percentage(user.deletion_confidence_interval, :precision => 0), posts_path(:tags => "uploader:#{user.name} status:deleted", :limit => 200) %></td>
|
|
||||||
<td><%= user.upload_limit %></td>
|
<td><%= user.upload_limit %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user