diff options
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 |
