diff options
Diffstat (limited to 'web/app.js')
| -rw-r--r-- | web/app.js | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -3377,16 +3377,17 @@ export function columnForTaskState(state) { // interrupted — newest-first (most recent failure is most urgent) // done — newest-first (most recently completed is most relevant) // running — newest-first (new-but-inconsequential default) -const TASK_COLUMN_SORT = { - queue: (a, b) => new Date(a.created_at || 0) - new Date(b.created_at || 0), - running: (a, b) => new Date(b.created_at || 0) - new Date(a.created_at || 0), - ready: (a, b) => new Date(a.created_at || 0) - new Date(b.created_at || 0), - interrupted: (a, b) => new Date(b.created_at || 0) - new Date(a.created_at || 0), - done: (a, b) => new Date(b.created_at || 0) - new Date(a.created_at || 0), +// Tasks with a missing created_at sort LAST in any direction (per sortTasksByDate). +const TASK_COLUMN_DESCEND = { + queue: false, + running: true, + ready: false, + interrupted: true, + done: true, }; // groupTasksByColumn returns { [columnKey]: task[] }, each sub-array sorted -// per the per-column sort direction above. +// per the per-column sort direction above via the shared sortTasksByDate helper. export function groupTasksByColumn(tasks) { const groups = {}; for (const col of TASK_COLUMNS) groups[col.key] = []; @@ -3396,8 +3397,7 @@ export function groupTasksByColumn(tasks) { groups[key].push(t); } for (const col of TASK_COLUMNS) { - const cmp = TASK_COLUMN_SORT[col.key]; - if (cmp) groups[col.key].sort(cmp); + groups[col.key] = sortTasksByDate(groups[col.key], TASK_COLUMN_DESCEND[col.key] ?? false); } return groups; } |
