feat: enhance reminder functionality with version tracking for shifts
Introduced a new column `version_at` in the shifts table to track the last change time of a shift's version. Updated reminder logic to skip reminders that are due before the shift's version change or the signup time. Modified related functions and tests to ensure correct behavior when managing reminders for shifts and signups, including scenarios for late signups and shift changes.
This commit is contained in:
1 parent
71130c3e8e
commit
17ca2f9dfb
6 files changed
+116
-16
No files matched your search
@@ -0,0 +1,14 @@
|
||||
-- version_at is when this shift's version last changed.
|
||||
-- A reminder due before that time, or before the signup, is not sent.
|
||||
ALTER TABLE shifts ADD COLUMN version_at TEXT NULL CHECK (
|
||||
version_at IS NULL
|
||||
OR version_at GLOB '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9]Z'
|
||||
);
|
||||
|
||||
UPDATE shifts
|
||||
SET version_at = (
|
||||
SELECT MAX(created_at)
|
||||
FROM outbox
|
||||
WHERE outbox.shift_id = shifts.id AND outbox.kind = 'changed'
|
||||
)
|
||||
WHERE version > 1;
|
||||
Reference in new issue
Block a user