diff --git a/app/logical/reports/user_promotions.rb b/app/logical/reports/user_promotions.rb deleted file mode 100644 index e71692451..000000000 --- a/app/logical/reports/user_promotions.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Reports - class UserPromotions - def self.deletion_confidence_interval_for(user, days = nil) - date = (days || 60).days.ago - deletions = Post.where("created_at >= ?", date).where(:uploader_id => user.id, :is_deleted => true).count - total = Post.where("created_at >= ?", date).where(:uploader_id => user.id).count - DanbooruMath.ci_lower_bound(deletions, total) - end - end -end diff --git a/app/models/user.rb b/app/models/user.rb index 10d13b843..b5c8ecb09 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -479,10 +479,16 @@ class User < ApplicationRecord end def adjusted_deletion_confidence - [deletion_confidence(60), 15].min + [deletion_confidence(60.days.ago), 15].min end memoize :adjusted_deletion_confidence + def deletion_confidence(date) + deletions = posts.deleted.where("created_at >= ?", date).count + total = posts.where("created_at >= ?", date).count + DanbooruMath.ci_lower_bound(deletions, total) + end + def base_upload_limit if created_at >= 1.month.ago 10 @@ -774,12 +780,6 @@ class User < ApplicationRecord end end - module StatisticsMethods - def deletion_confidence(days = 30) - Reports::UserPromotions.deletion_confidence_interval_for(self, days) - end - end - concerning :SockPuppetMethods do def validate_sock_puppets if User.where(last_ip_addr: CurrentUser.ip_addr).where("created_at > ?", 1.day.ago).exists? @@ -799,7 +799,6 @@ class User < ApplicationRecord include ApiMethods include CountMethods extend SearchMethods - include StatisticsMethods def as_current(&block) CurrentUser.as(self, &block)