mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 18:24:52 -06:00
DEV: Publish DiscourseEvent after top topic period is calculated (#29142)
This commit is contained in:
parent
374238b910
commit
909264ee75
@ -212,6 +212,8 @@ class TopTopic < ActiveRecord::Base
|
||||
SQL
|
||||
|
||||
DB.exec(sql, from: start_of(period))
|
||||
|
||||
DiscourseEvent.trigger(:top_score_computed, period: period)
|
||||
end
|
||||
|
||||
def self.start_of(period)
|
||||
|
@ -152,5 +152,12 @@ RSpec.describe TopTopic do
|
||||
0.0000000001,
|
||||
).of(10.602059991328)
|
||||
end
|
||||
|
||||
it "triggers a DiscourseEvent for each refreshed period" do
|
||||
events = DiscourseEvent.track_events(:top_score_computed) { TopTopic.refresh! }
|
||||
periods = events.map { |e| e[:params].first[:period] }
|
||||
|
||||
expect(periods).to match_array(%i[daily weekly monthly quarterly yearly all])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user