about summary refs log tree commit diff
path: root/app/models/account_stat.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/account_stat.rb')
-rw-r--r--app/models/account_stat.rb12
1 files changed, 2 insertions, 10 deletions
diff --git a/app/models/account_stat.rb b/app/models/account_stat.rb
index 9813aa84f..d5715268e 100644
--- a/app/models/account_stat.rb
+++ b/app/models/account_stat.rb
@@ -1,4 +1,5 @@
 # frozen_string_literal: true
+
 # == Schema Information
 #
 # Table name: account_stats
@@ -10,25 +11,16 @@
 #  followers_count :bigint(8)        default(0), not null
 #  created_at      :datetime         not null
 #  updated_at      :datetime         not null
-#  last_status_at  :datetime
 #
 
 class AccountStat < ApplicationRecord
   belongs_to :account, inverse_of: :account_stat
 
   def increment_count!(key)
-    update(attributes_for_increment(key))
+    update(key => public_send(key) + 1)
   end
 
   def decrement_count!(key)
     update(key => [public_send(key) - 1, 0].max)
   end
-
-  private
-
-  def attributes_for_increment(key)
-    attrs = { key => public_send(key) + 1 }
-    attrs[:last_status_at] = Time.now.utc if key == :statuses_count
-    attrs
-  end
 end