IFTA returns are due on fixed dates (Apr30/Jul31/Oct31/Jan31) and every interstate carrier (op code A, ~628k sendable) files 4x/year forever -- pure recurring revenue, no per-carrier deadline data needed. - build_ifta_quarterly_campaign.py: self-gates to the reminder window (~21d before each deadline), selects interstate carriers, mints the same-day coupon, builds+schedules the campaign reusing build_trucking_campaigns plumbing (DRY: one source of truth for sending/suppression/coupon). Per-quarter cycle reset (ifta_reminder_cycle marker) so each quarter re-reminds the full pool; marks ifta_reminded_at to avoid double-sends within a cycle. - ifta_quarterly_reminder.html: deadline + penalties + 'we do the math' + coupon + CAN-SPAM. Listmonk source campaign id 469. - migration 094: fmcsa_carriers.ifta_reminded_at column + partial index. Verified: deadline/window logic correct, imports reuse tc helpers, migration applied on prod.
11 lines
534 B
SQL
11 lines
534 B
SQL
-- Track which interstate carriers have been sent the IFTA quarterly-return
|
|
-- reminder this cycle, so the daily IFTA cron never double-sends within a quarter.
|
|
-- The IFTA campaign builder resets this column at the start of each new quarter's
|
|
-- reminder window (see build_ifta_quarterly_campaign.py).
|
|
|
|
ALTER TABLE fmcsa_carriers
|
|
ADD COLUMN IF NOT EXISTS ifta_reminded_at TIMESTAMPTZ;
|
|
|
|
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_fmcsa_carriers_ifta_reminded
|
|
ON fmcsa_carriers (ifta_reminded_at)
|
|
WHERE ifta_reminded_at IS NULL;
|