diff options
| author | Ben Sima <ben@bensima.com> | 2025-12-01 18:01:54 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-12-01 18:01:54 -0500 |
| commit | 26e7860347b1efb74a863ca90fad2ac9340a10f1 (patch) | |
| tree | 973e0c9d4bfdb35aa3a59d4a26f4e98422007633 /Omni/Task | |
| parent | 66529950ff99fd96b8e15f1e0da3a6b6add98bd3 (diff) | |
Sort ready queue by priority
getReadyTasks now returns tasks sorted by:
1. Priority (P0 first, then P1, P2, etc.)
2. Creation time (oldest first within same priority)
This ensures high-priority items are always at the top of both
the CLI 'jr task ready' output and the web dashboard.
Task-Id: t-220
Diffstat (limited to 'Omni/Task')
| -rw-r--r-- | Omni/Task/Core.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs index 8badf6b..0a1187f 100644 --- a/Omni/Task/Core.hs +++ b/Omni/Task/Core.hs @@ -810,7 +810,10 @@ getReadyTasks = do /= NeedsHelp && taskId task `notElem` needsInterventionIds - pure <| filter isReady openTasks + readyTasks = filter isReady openTasks + -- Sort by priority (P0 first) then by creation time (oldest first) + sorted = List.sortBy (comparing taskPriority <> comparing taskCreatedAt) readyTasks + pure sorted -- Get dependency tree getDependencyTree :: Text -> IO [Task] |
