uploads: replace old upload limits with new upload limits.
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
class DanbooruMath
|
||||
def self.ci_lower_bound(pos, n, confidence = 0.95)
|
||||
if n == 0
|
||||
return 0
|
||||
end
|
||||
|
||||
z = Statistics2.pnormaldist(1 - (1 - confidence) / 2)
|
||||
phat = 1.0 * pos / n
|
||||
100 * (phat + z * z / (2 * n) - z * Math.sqrt((phat * (1 - phat) + z * z / (4 * n)) / n)) / (1 + z * z / n)
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,23 @@ class UploadLimit
|
||||
end
|
||||
|
||||
def limited?
|
||||
used_upload_slots >= upload_slots
|
||||
if user.can_upload_free?
|
||||
false
|
||||
elsif user.created_at > 1.week.ago
|
||||
true
|
||||
else
|
||||
used_upload_slots >= upload_slots
|
||||
end
|
||||
end
|
||||
|
||||
def limit_reason
|
||||
if user.created_at > 1.week.ago
|
||||
"cannot upload during your first week of registration"
|
||||
elsif limited?
|
||||
"have reached your upload limit"
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def used_upload_slots
|
||||
|
||||
Reference in New Issue
Block a user