mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-18 00:46:45 +00:00
* fix(tasks): respect auto-add-to-today setting when completing tasks Completing an unscheduled top-level task stamped a completion-day dueDay even when "Automatically add worked-on tasks to today" was off (discussion #8463). The meta-reducer updateDoneOnForTask synthesizes that dueDay ungated by the setting, and the gated effect autoAddTodayTagOnMarkAsDone had become dead (the reducer set dueDay before its \!task.dueDay filter ran). Gating the reducer on the synced config would diverge on replay since ops apply in causal arrival order, so the decision is frozen into the op at completion time instead: getMarkDoneTaskChanges passes an explicit dueDay: null for an unscheduled top-level task when the setting is off, which trips the reducer's hasScheduleInUpdate guard and skips synthesis. null (not undefined) survives serialization for deterministic replay; the reducer itself is left untouched so legacy/replay behavior is unchanged. Applied at every completion producer: TaskService.setDone (the funnel for the context menu, reminders, bulk project-done, Android, etc.), the four components that dispatched updateTask directly (task-list, schedule-event, focus-mode-main/break now route through setDone), and the moveTaskToDone$ and auto-mark-parent effects. The dead autoAddTodayTagOnMarkAsDone effect is removed so completion-dating has a single source of truth. Only future completions are affected; already-dated tasks are unchanged. * fix(tasks): freeze offset-correct completion day into the op Follow-up to the auto-add-to-today fix. When auto-add is on, the completion day was still synthesized by the reducer, which derives it from doneOn via the offset-blind getDbDateStr during replay while the live path used the offset-adjusted todayStr. For users with a custom "start of next day" this made the stamped dueDay differ between the originating device (logical day) and a replaying device (calendar day). getMarkDoneTaskChanges now freezes the offset-adjusted logical day (DateService.todayStr) into the op for unscheduled top-level completions (dueDay: todayStr when on, dueDay: null when off). Producers pass todayStr; the reducer applies the explicit value and its synthesis stays only as a legacy fallback. Replay reproduces the frozen value, so the day is both offset-correct and identical across devices. TODAY_TAG membership is unchanged (the dueDay-change branch fires identically for an explicit vs synthesized today). * refactor(tasks): record only doneOn on completion, never stamp dueDay Completion no longer synthesizes or freezes a dueDay (reverting the Option A gating and the May-18 completion-day stamp). The Today "Done" list is driven by isDone/doneOn, not dueDay, so completed tasks still show there. Existing schedules are preserved on completion; the isAutoAddWorkedOnToToday setting now gates only the time-tracking auto-add path. Removes the dead autoAddTodayTagOnMarkAsDone effect, the reducer dueDay synthesis, and the converter's legacy dueDay back-fill (keeping the doneOn back-fill). * refactor(tasks): simplify done-today counter, document legacy-op sanitizer Multi-review follow-up. The done-today counter now counts via the flat selectAllTasks instead of selectAllTasksWithSubTasks + flattenTasks (same count, no per-emission nesting/allocation). Adds a comment clarifying that sanitizeDoneScheduleChanges now exists only as legacy-op replay defense. * test(workflow): pin finish-day archive of unscheduled completed tasks Regression guard for discussion #8463. Since completion now records only doneOn (no dueDay), this e2e proves an unscheduled completed task still (a) shows in the Today Done list and (b) is cleared to the archive on Finish Day — both driven by isDone/doneOn, not dueDay. Fails if a future change scopes the Today Done list or the finish-day archive by dueDay. * chore: drop stray plugin-dev lockfile changes from e2e build The e2e plugin build bumped vite in packages/plugin-dev lockfiles; that churn was unintentionally swept into the test commit and is unrelated to this PR. Restore both lockfiles to the base version. * test(archive): archived completion no longer stamps dueDay The TaskArchiveService.updateTask path runs the same task-shared meta-reducer as live tasks, so #8463's "completion records only doneOn, never dueDay" now applies there too. Update the assertion: completing an archived task sets doneOn but leaves dueDay undefined. |
||
|---|---|---|
| .. | ||
| finish-day-archives-unscheduled.spec.ts | ||
| finish-day-complete.spec.ts | ||