From 3bf01cba1f38655f3b2806434d02d84f53c8b784 Mon Sep 17 00:00:00 2001 From: Ricky Stretch Date: Sat, 28 Mar 2026 21:03:12 -0400 Subject: [PATCH] schedules bug fix --- backend/src/routes/schedule.js | 4 ++-- frontend/src/components/SchedulePage.jsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/routes/schedule.js b/backend/src/routes/schedule.js index 7a4a812..f6e62da 100644 --- a/backend/src/routes/schedule.js +++ b/backend/src/routes/schedule.js @@ -377,9 +377,9 @@ router.delete('/:id', authMiddleware, async (req, res) => { AND title=$2 AND start_at >= $3 `, [event.created_by, event.title, event.start_at]); } else if (recurringScope === 'all' && event.recurrence_rule) { - // Delete every occurrence + // Delete present and future occurrences only — preserve past records await exec(req.schema, ` - DELETE FROM events WHERE created_by=$1 AND recurrence_rule IS NOT NULL AND title=$2 + DELETE FROM events WHERE created_by=$1 AND recurrence_rule IS NOT NULL AND title=$2 AND end_at >= NOW() `, [event.created_by, event.title]); } else { await exec(req.schema, 'DELETE FROM events WHERE id=$1', [req.params.id]); diff --git a/frontend/src/components/SchedulePage.jsx b/frontend/src/components/SchedulePage.jsx index 4c5ce61..a264b37 100644 --- a/frontend/src/components/SchedulePage.jsx +++ b/frontend/src/components/SchedulePage.jsx @@ -782,7 +782,7 @@ function EventDetailModal({ event, onClose, onEdit, onAvailabilityChange, isTool },[event]); const counts={going:0,maybe:0,not_going:0}; avail.forEach(r=>{if(counts[r.response]!==undefined)counts[r.response]++;}); - const isPast = !event.all_day && event.end_at && new Date(event.end_at) < new Date(); + const isPast = !!event.end_at && new Date(event.end_at) < new Date(); const noteChanged = noteInput.trim() !== myNote.trim(); const handleResp=async resp=>{