masteryComposition function
Topic count grouped by mastery level (0..5). Drives the stacked bar in
_MasteryCompositionPanel. Level 0 = unstarted, 1 = awareness,
2 = understanding, 3 = application, 4 = evaluation, 5 = mastery.
Implementation
@riverpod
Future<Map<int, int>> masteryComposition(Ref ref) async {
final progress = await ref.watch(allProgressProvider.future);
final counts = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0};
for (final p in progress) {
final level = masteryLevelFromString(p.mastery);
counts[level] = counts[level]! + 1;
}
return counts;
}