Files
jira/src/lib/boardGrouping.ts
Bastien COIGNOUX 7cd2d6dc40 init
2026-04-24 07:41:55 +02:00

18 lines
678 B
TypeScript

import type { StoryGroup } from '../types/jira'
/** Regroupe les stories par premier composant Jira, sinon « Autres ». */
export function groupStoriesByComponent(groups: StoryGroup[]): Map<string, StoryGroup[]> {
const map = new Map<string, StoryGroup[]>()
for (const g of groups) {
const comps = g.story.fields.components
const label =
comps && comps.length > 0 ? comps[0]!.name : 'Autres'
if (!map.has(label)) map.set(label, [])
map.get(label)!.push(g)
}
const keys = [...map.keys()].sort((a, b) => a.localeCompare(b, 'fr'))
const sorted = new Map<string, StoryGroup[]>()
for (const k of keys) sorted.set(k, map.get(k)!)
return sorted
}