summaryrefslogtreecommitdiff
path: root/internal/handlers/handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/handlers/handlers.go')
-rw-r--r--internal/handlers/handlers.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go
index eaef558..6c74fff 100644
--- a/internal/handlers/handlers.go
+++ b/internal/handlers/handlers.go
@@ -607,6 +607,14 @@ func (h *Handler) handleAtomToggle(w http.ResponseWriter, r *http.Request, compl
return
}
+ // Capture title/dueDate before mutating state so doot tasks (which are
+ // queried with WHERE completed=0) are still findable.
+ var preTitle string
+ var preDueDate *time.Time
+ if complete {
+ preTitle, preDueDate = h.getAtomDetails(id, source)
+ }
+
var err error
switch source {
case "doot":
@@ -658,8 +666,8 @@ func (h *Handler) handleAtomToggle(w http.ResponseWriter, r *http.Request, compl
}
if complete {
- // Get task details before removing from cache
- title, dueDate := h.getAtomDetails(id, source)
+ // Use pre-fetched details (captured before mutation above).
+ title, dueDate := preTitle, preDueDate
// Log to completed tasks
_ = h.store.SaveCompletedTask(source, id, title, dueDate)