0
0
Fork 0

Add FeaturedTag coverage, use pick in model (#31828)

This commit is contained in:
Matt Jankowski 2024-09-09 15:57:19 -04:00 committed by GitHub
parent a021dee642
commit d0ab94c4d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 132 additions and 2 deletions

View file

@ -45,7 +45,7 @@ class FeaturedTag < ApplicationRecord
end
def decrement(deleted_status_id)
update(statuses_count: [0, statuses_count - 1].max, last_status_at: visible_tagged_account_statuses.where.not(id: deleted_status_id).select(:created_at).first&.created_at)
update(statuses_count: [0, statuses_count - 1].max, last_status_at: visible_tagged_account_statuses.where.not(id: deleted_status_id).pick(:created_at))
end
private
@ -56,7 +56,7 @@ class FeaturedTag < ApplicationRecord
def reset_data
self.statuses_count = visible_tagged_account_statuses.count
self.last_status_at = visible_tagged_account_statuses.select(:created_at).first&.created_at
self.last_status_at = visible_tagged_account_statuses.pick(:created_at)
end
def validate_featured_tags_limit