diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-20 14:35:23 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-20 14:35:23 -0500 |
| commit | 45174fce486e3ce822734445bfe975f8a9a28b69 (patch) | |
| tree | 8a3ceffe611fd4cc014ace3fcf0dd550e1344923 /Omni | |
| parent | eab575ad7ce423f053c87c45225853dd51aa252f (diff) | |
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 <amp@ampcode.com>
Diffstat (limited to 'Omni')
| -rw-r--r-- | Omni/Task/Core.hs | 38 |
1 files changed, 29 insertions, 9 deletions
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 |
