Allinea i KPI su due righe e aggiunge lo storico orario degli invii confermati.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -46,6 +46,26 @@ class Mailings::HourlyThroughputTest < ActiveSupport::TestCase
|
||||
assert_equal 1, stats.recent_sent
|
||||
end
|
||||
|
||||
test "builds twelve hourly buckets of confirmed sends" do
|
||||
now = Time.zone.parse("2026-09-07 12:40")
|
||||
travel_to now do
|
||||
add_recipient status: "sent", sent_at: now - 20.minutes
|
||||
add_recipient status: "sent", sent_at: now - 70.minutes, mailing: extra_mailing("Ore 11")
|
||||
add_recipient status: "sent", sent_at: now - 80.minutes, mailing: extra_mailing("Ore 11 bis")
|
||||
add_recipient status: "sent", sent_at: now - 13.hours, mailing: extra_mailing("Fuori finestra")
|
||||
|
||||
stats = Mailings::HourlyThroughput.new(@project, now: now)
|
||||
history = stats.hourly_history
|
||||
|
||||
assert_equal 12, history.size
|
||||
assert_equal now.beginning_of_hour, history.last[:at]
|
||||
assert_equal 1, history.last[:count]
|
||||
assert_equal 2, history[-2][:count]
|
||||
assert_equal 0, history.first[:count]
|
||||
assert_equal 3, stats.history_total
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def extra_mailing(name = "Altra campagna")
|
||||
|
||||
Reference in New Issue
Block a user