Files
jira/src/lib/phaseAggregate.ts
Bastien COIGNOUX 020f5d11de gantt
2026-04-24 21:08:34 +02:00

20 lines
647 B
TypeScript

import type { PhaseId, StoryGroup } from '../types/jira'
import type { LaneLabelsConfig } from './laneDetection'
import type { StatusBucketConfig } from './statusBuckets'
import { effectivePipelinePhase } from './pipelinePhase'
export function countSubtasksByPhase(
groups: StoryGroup[],
bucketCfg: StatusBucketConfig,
laneCfg?: LaneLabelsConfig | null,
): Record<PhaseId, number> {
const acc: Record<PhaseId, number> = { analyse: 0, design: 0, integration: 0, done: 0 }
for (const g of groups) {
for (const s of g.subtasks) {
const p = effectivePipelinePhase(s, bucketCfg, laneCfg)
acc[p] += 1
}
}
return acc
}