fix: auto-set reminder 'coming' only for today/tomorrow confirmations
Confirming a booking for today or tomorrow auto-sets reminder_status to 'coming'. Confirming for later dates leaves it unset — admin will need to check closer to the event.
This commit is contained in:
@@ -726,9 +726,13 @@ export function setGroupBookingStatus(
|
||||
): void {
|
||||
const db = getDb();
|
||||
if (status === "confirmed" && confirmation) {
|
||||
// Auto-set reminder to 'coming' only if confirmed for today/tomorrow
|
||||
const today = new Date().toISOString().split("T")[0];
|
||||
const tomorrow = new Date(Date.now() + 86400000).toISOString().split("T")[0];
|
||||
const reminderStatus = (confirmation.date === today || confirmation.date === tomorrow) ? "coming" : null;
|
||||
db.prepare(
|
||||
"UPDATE group_bookings SET status = ?, confirmed_date = ?, confirmed_group = ?, confirmed_comment = ?, notified_confirm = 1, reminder_status = 'coming' WHERE id = ?"
|
||||
).run(status, confirmation.date, confirmation.group, confirmation.comment || null, id);
|
||||
"UPDATE group_bookings SET status = ?, confirmed_date = ?, confirmed_group = ?, confirmed_comment = ?, notified_confirm = 1, reminder_status = ? WHERE id = ?"
|
||||
).run(status, confirmation.date, confirmation.group, confirmation.comment || null, reminderStatus, id);
|
||||
} else {
|
||||
db.prepare(
|
||||
"UPDATE group_bookings SET status = ?, confirmed_date = NULL, confirmed_group = NULL, confirmed_comment = NULL, notified_confirm = 1 WHERE id = ?"
|
||||
|
||||
Reference in New Issue
Block a user