tududi/backend/modules/tasks
Chris 01a84c3598
Fix: Bi-weekly recurring task scheduling for multi-day patterns (#1005)
* fix: correct bi-weekly recurring task scheduling for multi-day patterns

Fixes #1004

Previously, when a recurring task was set to repeat every N weeks (where N > 1)
on multiple weekdays that span a week boundary (e.g., Saturday + Sunday), the
algorithm incorrectly calculated the next occurrence dates.

The issue was in the calculateWeeklyRecurrence function, which didn't properly
determine when to add the interval skip for multi-weekday patterns. It would:
- Correctly handle Sat -> Sun (adjacent days, same cycle)
- Incorrectly handle Sun -> Sat (should skip weeks, but didn't)

This fix improves the logic to:
1. Detect when the current day is the last weekday in the pattern cycle
2. Account for Sunday (day 0) wrapping around in the day-of-week numbering
3. Only add interval skips when truly moving to a new cycle, not when moving
   between weekdays within the same cycle

Test coverage added for:
- Bi-weekly Saturday + Sunday pattern (the reported bug)
- Starting from different days in the pattern
- Bi-weekly Tuesday + Thursday pattern
- Tri-weekly Friday + Saturday + Sunday pattern

* docs: update MEMORY.md with GitHub template requirements

- Add detailed PR template requirements and structure
- Expand bug report template requirements with all fields
- Update last modified date
2026-04-12 08:52:13 +03:00
..
core Fix initial due date calculation for weekly tasks with multiple weekdays (#974) (#975) 2026-03-26 17:19:59 +02:00
middleware Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
operations fix: prevent subtasks from disappearing when updating parent task (#984) 2026-04-01 17:37:20 +03:00
queries Fix subtask ordering to prevent random reordering (#930) 2026-03-10 00:17:26 +02:00
utils fix: prevent subtasks from disappearing when updating parent task (#984) 2026-04-01 17:37:20 +03:00
attachments.js Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
deferredTaskService.js Fix Telegram notification spam with channel-level rate limiting (#951) 2026-03-19 20:26:11 +02:00
dueTaskService.js Fix Telegram notification spam with channel-level rate limiting (#951) 2026-03-19 20:26:11 +02:00
events.js Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
index.js Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
recurringTaskService.js Fix: Bi-weekly recurring task scheduling for multi-day patterns (#1005) 2026-04-12 08:52:13 +03:00
repository.js Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
routes.js Fix Today page task completion issues (#970) 2026-03-24 16:45:31 +02:00
taskEventService.js Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
taskScheduler.js Fix issue with wrong path 2026-01-18 09:47:12 +02:00
taskSummaryService.js Fix Telegram task display bug by escaping backslashes (#860) 2026-02-24 14:19:45 +02:00