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
+3
-3
@@ -1626,10 +1626,10 @@ function bumpAndNotify(db: Database.Database, shiftId: number, now: string, mail
|
||||
const bumped = db
|
||||
.prepare(
|
||||
manual
|
||||
? 'UPDATE shifts SET version = version + 1, manually_modified = 1 WHERE id = ? AND cancelled = 0'
|
||||
: 'UPDATE shifts SET version = version + 1 WHERE id = ? AND cancelled = 0 AND manually_modified = 0',
|
||||
? 'UPDATE shifts SET version = version + 1, version_at = ?, manually_modified = 1 WHERE id = ? AND cancelled = 0'
|
||||
: 'UPDATE shifts SET version = version + 1, version_at = ? WHERE id = ? AND cancelled = 0 AND manually_modified = 0',
|
||||
)
|
||||
.run(shiftId);
|
||||
.run(now, shiftId);
|
||||
if (bumped.changes !== 1) return 0;
|
||||
db.prepare(
|
||||
`UPDATE outbox
|
||||
|
||||
Reference in new issue
Block a user