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 { const acc: Record = { 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 }