Kairo-Jinkendo/frontend/src/utils/workCycleActions.js
Lars e221b5b09f
All checks were successful
Deploy Development / deploy (push) Successful in 52s
Test Suite / pytest-backend (push) Successful in 2m46s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 12s
fix: Sprint-Planung einsehbar und Eingang ohne Voll-Reload.
Geplante Sprints in Plan anwaehlbar, lokales Update beim Commit, Sprint-Auswahl bleibt erhalten.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-12 19:38:39 +02:00

28 lines
1002 B
JavaScript

/**
* Arbeitspakete eines Sprints (work_cycle) filtern.
* @param {Array<{ id: string, work_cycle_id?: string, status?: string }>} actions
* @param {string | null | undefined} cycleId
* @param {{ hideDone?: boolean }} options
*/
export function filterActionsForWorkCycle(actions, cycleId, { hideDone = true } = {}) {
if (!cycleId) return []
let list = Array.isArray(actions) ? actions : []
if (hideDone) {
list = list.filter((a) => a.status !== 'done' && a.status !== 'discarded')
}
return list.filter((a) => a.work_cycle_id === cycleId)
}
/**
* @param {Array<{ work_cycle_id?: string, status?: string }>} actions
*/
export function countActionsByWorkCycle(actions, { hideDone = true } = {}) {
const counts = {}
for (const action of actions || []) {
if (!action.work_cycle_id) continue
if (hideDone && (action.status === 'done' || action.status === 'discarded')) continue
counts[action.work_cycle_id] = (counts[action.work_cycle_id] || 0) + 1
}
return counts
}