reduce factor of comic uploads

This commit is contained in:
r888888888
2015-09-16 14:02:02 -07:00
parent a098052ec1
commit 6297ff8638
2 changed files with 4 additions and 2 deletions

View File

@@ -532,7 +532,8 @@ class User < ActiveRecord::Base
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
limit = max_count - uploaded_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)
if limit < 0
limit = 0

View File

@@ -58,8 +58,9 @@ class UserPresenter
multiplier = (1 - (dcon / 15.0))
max_count = [(user.base_upload_limit * multiplier).ceil, 5].max
uploaded_count = Post.for_user(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
"(#{user.base_upload_limit} * #{'%0.2f' % multiplier}) - #{uploaded_count} = #{user.upload_limit}"
"(#{user.base_upload_limit} * #{'%0.2f' % multiplier}) - #{uploaded_count - uploaded_comic_count} = #{user.upload_limit}"
end
def uploads