Files
ridebus-admin/backend/migrations/009_alert_scheduling.sql
Zakhar Timoshenko 595ad6456b feat: add schedule import functionality and quality control page
- Implemented the schedule import feature with a dedicated page for importing schedules from the transport website.
- Added a new QualityPage to check the quality of routes, stops, schedules, and notifications without making automatic changes.
- Created CSS styles for both the ScheduleImportPage and QualityPage to enhance the user interface.
- Introduced API calls for fetching schedule data and quality reports.
- Added error handling and loading states for better user experience during data fetching.
- Included functionality for filtering quality issues and displaying detailed reports.
2026-09-16 21:55:50 +03:00

20 lines
886 B
SQL

-- Delivery state is separate from visibility. A scheduled alert becomes visible
-- at start_time; this state makes sure its push notification is sent once.
ALTER TABLE alerts
ADD COLUMN IF NOT EXISTS notification_sent_at TIMESTAMPTZ,
ADD COLUMN IF NOT EXISTS notification_claimed_at TIMESTAMPTZ,
ADD COLUMN IF NOT EXISTS notification_attempts INTEGER NOT NULL DEFAULT 0;
CREATE INDEX IF NOT EXISTS idx_alerts_pending_notification
ON alerts (start_time)
WHERE is_active = true AND notification_sent_at IS NULL;
-- Earlier versions sent every active alert immediately on creation. Mark those
-- already-created future alerts as dispatched, so upgrading does not notify
-- passengers a second time when the scheduler starts.
UPDATE alerts
SET notification_sent_at = created_at
WHERE notification_sent_at IS NULL
AND is_active = true
AND start_time > created_at;