From fa95c71494458070b78270e3d9170076028fc974 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Sun, 25 Jan 2026 20:04:03 -1000 Subject: Refactor: extract helpers and clean up hardcoded HTML - Extract parseEventTime() and deduplicateEvents() in google_calendar.go - Add scanTask() and scanTasks() SQL helpers in sqlite.go - Move completed-atom HTML to partial template - Add loadTestTemplates() test helper for template-dependent tests Co-Authored-By: Claude Opus 4.5 --- internal/handlers/handlers.go | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'internal/handlers/handlers.go') diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index ee28a87..e0e185d 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -665,22 +665,12 @@ func (h *Handler) handleAtomToggle(w http.ResponseWriter, r *http.Request, compl } // Return completed task HTML with uncomplete option - completedHTML := fmt.Sprintf(`
-
- - -
-

%s

-
Completed - click to undo
-
-
-
`, template.HTMLEscapeString(id), template.HTMLEscapeString(source), template.HTMLEscapeString(title)) - HTMLString(w, completedHTML) + data := struct { + ID string + Source string + Title string + }{id, source, title} + HTMLResponse(w, h.templates, "completed-atom", data) } else { // Invalidate cache to force refresh switch source { -- cgit v1.2.3