20 lines
647 B
TypeScript
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
|
|
}
|