From 45174fce486e3ce822734445bfe975f8a9a28b69 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 20 Nov 2025 14:35:23 -0500 Subject: task: implement epic progress tracking - Add progress display to 'task show' for epics (X/Y with percentage) - Add progress display to 'task list --type=epic' showing [X/Y] - Progress already shown in 'task tree' as [X/Y] - Calculate completed/total child tasks for epics - Clean up test tasks accidentally created in production database All 31 tests passing. Amp-Thread-ID: https://ampcode.com/threads/T-4e6225cf-3e78-4538-963c-5377bbbccee8 Co-authored-by: Amp --- Omni/Task/Core.hs | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'Omni/Task/Core.hs') diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs index e9da38e..3da47aa 100644 --- a/Omni/Task/Core.hs +++ b/Omni/Task/Core.hs @@ -372,28 +372,39 @@ showTaskTree maybeId = do -- Helper to print a task printTask :: Task -> IO () -printTask t = +printTask t = do + tasks <- loadTasks + let progressInfo = + if taskType t == Epic + then + let children = filter (\child -> taskParent child == Just (taskId t)) tasks + total = length children + completed = length <| filter (\child -> taskStatus child == Done) children + in " [" <> T.pack (show completed) <> "/" <> T.pack (show total) <> "]" + else "" + parentInfo = case taskParent t of + Nothing -> "" + Just p -> " (parent: " <> p <> ")" + namespaceInfo = case taskNamespace t of + Nothing -> "" + Just ns -> " [" <> ns <> "]" putText <| taskId t <> " [" <> T.pack (show (taskType t)) <> "] [" <> T.pack (show (taskStatus t)) - <> "] " + <> "]" + <> progressInfo + <> " " <> taskTitle t <> parentInfo <> namespaceInfo - where - parentInfo = case taskParent t of - Nothing -> "" - Just p -> " (parent: " <> p <> ")" - namespaceInfo = case taskNamespace t of - Nothing -> "" - Just ns -> " [" <> ns <> "]" -- Show detailed task information (human-readable) showTaskDetailed :: Task -> IO () showTaskDetailed t = do + tasks <- loadTasks putText "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" putText <| "Task: " <> taskId t putText "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" @@ -401,6 +412,15 @@ showTaskDetailed t = do putText <| "Type: " <> T.pack (show (taskType t)) putText <| "Status: " <> T.pack (show (taskStatus t)) putText <| "Priority: " <> T.pack (show (taskPriority t)) <> priorityDesc + + -- Show epic progress if this is an epic + when (taskType t == Epic) <| do + let children = filter (\child -> taskParent child == Just (taskId t)) tasks + total = length children + completed = length <| filter (\child -> taskStatus child == Done) children + percentage = if total == 0 then 0 else (completed * 100) `div` total + putText <| "Progress: " <> T.pack (show completed) <> "/" <> T.pack (show total) <> " (" <> T.pack (show percentage) <> "%)" + case taskParent t of Nothing -> pure () Just p -> putText <| "Parent: " <> p -- cgit v1.2.3