init
This commit is contained in:
17
src/lib/boardGrouping.ts
Normal file
17
src/lib/boardGrouping.ts
Normal file
@ -0,0 +1,17 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user