profileShare

rasmusjy / voicetask

Read-only snapshot

No repository description.

main default branch 105 files Expires Sep 13, 2026, 9:06 AM
coverage.ts 693 bytes
1 import { CATEGORY_IDS, type CategoryId, type Coverage, type CoverageLevel } from '../../shared/types'
2
3 const LEVEL_PRIORITY: Record<CoverageLevel, number> = { missing: 0, partial: 1, clear: 2 }
4
5 export function weakestCategory(coverage: Coverage): CategoryId | null {
6 let weakest: CategoryId | null = null
7 for (const category of CATEGORY_IDS) {
8 if (coverage[category] === 'clear') continue
9 if (weakest === null || LEVEL_PRIORITY[coverage[category]] < LEVEL_PRIORITY[coverage[weakest]]) {
10 weakest = category
11 }
12 }
13 return weakest
14 }
15
16 export function isFullyCovered(coverage: Coverage): boolean {
17 return CATEGORY_IDS.every((category) => coverage[category] === 'clear')
18 }
19