Add emoji reactions to trends

This commit is contained in:
KMY 2023-04-10 14:08:53 +09:00
parent bc48000dce
commit e6fcf1543b
8 changed files with 33 additions and 14 deletions

View file

@ -4,14 +4,15 @@
#
# Table name: status_stats
#
# id :bigint(8) not null, primary key
# status_id :bigint(8) not null
# replies_count :bigint(8) default(0), not null
# reblogs_count :bigint(8) default(0), not null
# favourites_count :bigint(8) default(0), not null
# created_at :datetime not null
# updated_at :datetime not null
# emoji_reactions :string
# id :bigint(8) not null, primary key
# status_id :bigint(8) not null
# replies_count :bigint(8) default(0), not null
# reblogs_count :bigint(8) default(0), not null
# favourites_count :bigint(8) default(0), not null
# created_at :datetime not null
# updated_at :datetime not null
# emoji_reactions :string
# emoji_reactions_count :integer default(0), not null
#
class StatusStat < ApplicationRecord
@ -35,6 +36,10 @@ class StatusStat < ApplicationRecord
attributes['emoji_reactions'] || ''
end
def emoji_reactions_count
[attributes['emoji_reactions_count'], 0].max
end
private
def reset_parent_cache