Change column name emoji_reactions_count_per_account to emoji_reaction_accounts_count
This commit is contained in:
parent
b8aefa0930
commit
81f32dee4f
5 changed files with 19 additions and 19 deletions
|
@ -318,8 +318,8 @@ class Status < ApplicationRecord
|
|||
status_stat&.emoji_reactions_count || 0
|
||||
end
|
||||
|
||||
def emoji_reactions_count_per_account
|
||||
status_stat&.emoji_reactions_count_per_account || 0
|
||||
def emoji_reaction_accounts_count
|
||||
status_stat&.emoji_reaction_accounts_count || 0
|
||||
end
|
||||
|
||||
def increment_count!(key)
|
||||
|
@ -349,7 +349,7 @@ class Status < ApplicationRecord
|
|||
|
||||
def refresh_emoji_reactions_grouped_by_name!
|
||||
generate_emoji_reactions_grouped_by_name.tap do |emoji_reactions_json|
|
||||
update_status_stat!(emoji_reactions: emoji_reactions_json, emoji_reactions_count: emoji_reactions.size, emoji_reactions_count_per_account: emoji_reactions.map(&:account_id).uniq.size)
|
||||
update_status_stat!(emoji_reactions: emoji_reactions_json, emoji_reactions_count: emoji_reactions.size, emoji_reaction_accounts_count: emoji_reactions.map(&:account_id).uniq.size)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
#
|
||||
# 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
|
||||
# emoji_reactions_count :integer default(0), not null
|
||||
# test :integer default(0), not null
|
||||
# emoji_reactions_count_per_account :integer default(0), not null
|
||||
# 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
|
||||
# test :integer default(0), not null
|
||||
# emoji_reaction_accounts_count :integer default(0), not null
|
||||
#
|
||||
|
||||
class StatusStat < ApplicationRecord
|
||||
|
@ -42,8 +42,8 @@ class StatusStat < ApplicationRecord
|
|||
[attributes['emoji_reactions_count'], 0].max
|
||||
end
|
||||
|
||||
def emoji_reactions_count_per_account
|
||||
[attributes['emoji_reactions_count_per_account'], 0].max
|
||||
def emoji_reaction_accounts_count
|
||||
[attributes['emoji_reaction_accounts_count'], 0].max
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -97,7 +97,7 @@ class Trends::Statuses < Trends::Base
|
|||
def calculate_scores(statuses, at_time)
|
||||
items = statuses.map do |status|
|
||||
expected = 1.0
|
||||
observed = (status.reblogs_count + status.favourites_count + status.emoji_reactions_count_per_account * 0.8).to_f
|
||||
observed = (status.reblogs_count + status.favourites_count + status.emoji_reaction_accounts_count * 0.8).to_f
|
||||
|
||||
score = if expected > observed || observed < options[:threshold]
|
||||
0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue