fixes #2521: User promotion report shows remaining limit instead of limit

This commit is contained in:
r888888888
2015-09-22 14:10:29 -07:00
parent aa212e3616
commit f815d718e1
2 changed files with 7 additions and 4 deletions

View File

@@ -527,13 +527,16 @@ class User < ActiveRecord::Base
end
end
def max_upload_limit
dcon = [deletion_confidence(120), 15].min
[(base_upload_limit * (1 - (dcon / 15.0))).ceil, 10].max
end
def upload_limit
@upload_limit ||= begin
dcon = [deletion_confidence(120), 15].min
max_count = [(base_upload_limit * (1 - (dcon / 15.0))).ceil, 10].max
uploaded_count = Post.for_user(id).where("created_at >= ?", 24.hours.ago).count
uploaded_comic_count = Post.for_user(id).tag_match("comic").where("created_at >= ?", 24.hours.ago).count / 3
limit = max_count - (uploaded_count - uploaded_comic_count)
limit = max_upload_limit - (uploaded_count - uploaded_comic_count)
if limit < 0
limit = 0

View File

@@ -26,7 +26,7 @@
<td data-sort-value="<%= user.created_at.to_formatted_s(:db) %>"><%= time_ago_in_words user.created_at %></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>
<td><%= user.upload_limit %></td>
<td><%= user.max_upload_limit %></td>
</tr>
<% end %>
<% end %>