From c2e880031228f4feb9fc4ef56c208057c6819370 Mon Sep 17 00:00:00 2001 From: Trey t Date: Tue, 13 Jan 2026 17:50:36 -0600 Subject: [PATCH] Fix task due date update not persisting for tasks with completions When a user explicitly edited a task's due date, the backend was only updating NextDueDate if the task had no completions. For recurring tasks with completions, this caused the UI to show stale NextDueDate values since effectiveDueDate prioritizes NextDueDate over DueDate. Now always updates NextDueDate when user explicitly edits due date. Completion logic will still recalculate NextDueDate when task is completed. Co-Authored-By: Claude Opus 4.5 --- internal/services/task_service.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/services/task_service.go b/internal/services/task_service.go index f8f2d46..e0fe4d3 100644 --- a/internal/services/task_service.go +++ b/internal/services/task_service.go @@ -251,11 +251,10 @@ func (s *TaskService) UpdateTask(taskID, userID uint, req *requests.UpdateTaskRe if req.DueDate != nil { newDueDate := req.DueDate.ToTimePtr() task.DueDate = newDueDate - // Also update NextDueDate if the task doesn't have completions yet - // (if it has completions, NextDueDate should be managed by completion logic) - if len(task.Completions) == 0 { - task.NextDueDate = newDueDate - } + // Always update NextDueDate when user explicitly edits due date. + // Completion logic will recalculate NextDueDate when task is completed, + // but manual edits should take precedence. + task.NextDueDate = newDueDate } if req.EstimatedCost != nil { task.EstimatedCost = req.EstimatedCost