upload limit changes

This commit is contained in:
albert
2013-03-22 21:39:35 -04:00
parent 33138741d9
commit 62b4441413
2 changed files with 2 additions and 2 deletions

View File

@@ -437,7 +437,7 @@ class User < ActiveRecord::Base
pending_count = Post.for_user(id).pending.where("created_at >= ?", 3.days.ago).count
approved_count = Post.where("is_flagged = false and is_pending = false and is_deleted = false and uploader_id = ? and created_at >= ?", id, 1.year.ago).count
if base_upload_limit.to_i > 0
if base_upload_limit.to_i != 0
limit = [base_upload_limit - (deleted_count / 2), 4].max - pending_count
else
limit = [10 + [approved_count / 2, 90].min - (deleted_count / 2), 4].max - pending_count

View File

@@ -42,7 +42,7 @@ class UserPresenter
pending_count = Post.for_user(user.id).pending.where("created_at >= ?", 3.days.ago).count
approved_count = Post.where("is_flagged = false and is_pending = false and is_deleted = false and uploader_id = ? and created_at >= ?", user.id, 1.year.ago).count
if user.base_upload_limit
if user.base_upload_limit.to_i != 0
string = "max(base_upload_limit:#{user.base_upload_limit} - (deleted_count:#{deleted_count} / 2), 4) - pending_count:#{pending_count}"
else
string = "max(10 + min(approved_count:#{approved_count} / 2, 90) - (deleted_count:#{deleted_count} / 2), 4) - pending_count:#{pending_count}"