Class: ProblematicDeliveryDigestMailer
- Inherits:
-
InternalNotificationMailer
- Object
- ActionMailer::Base
- ApplicationMailer
- InternalNotificationMailer
- ProblematicDeliveryDigestMailer
- Defined in:
- app/mailers/problematic_delivery_digest_mailer.rb
Overview
Once-a-day roll-up of every delivery ProblematicDeliverySweep currently
flags, critical first — see ProblematicDeliveryDigestWorker.
Replaces the per-incident escalation this used to send. Two things drove
that: sales asked to be taken off it ("we lack the time to manage delayed
shipments; this is an operational and logistical matter rather than a sales
responsibility" — 2026-08-06), and a per-incident email cannot say whether
anything actually changed since yesterday, which is the only question the
reader has. So the audience is orders@ alone — no sales rep, no sales
manager, on direct-customer orders as much as marketplace ones — and the
cadence is one message a day carrying the whole list.
The dashboard is unchanged and remains the detailed view; this email exists
to make someone look at it.
Instance Method Summary collapse
Methods inherited from InternalNotificationMailer
Methods included from SendgridSmtpApi::InternalMailerHeaders
Methods inherited from ApplicationMailer
Instance Method Details
#digest(rows) ⇒ Mail::Message
24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/mailers/problematic_delivery_digest_mailer.rb', line 24 def digest(rows) @critical = rows.select { |row| row[:severity] == :critical } @warning = rows.select { |row| row[:severity] == :warning } @new_count = rows.count { |row| row[:new] } mail( to: ORDERS_EMAIL, subject: "Problematic deliveries: #{@critical.size} critical, #{@warning.size} warning" \ "#{" (#{@new_count} new)" if @new_count.positive?}" ) end |