Allinea i KPI su due righe e aggiunge lo storico orario degli invii confermati.
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / scan_ruby (push) Has been cancelled

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-07 12:53:38 +02:00
co-authored by Cursor
parent 390cb0e657
commit 1c6b4bbabe
4 changed files with 61 additions and 1 deletions
@@ -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")