Milestone.fromMasteryTransition constructor
Pick a tone heuristically from the mastery transition. Higher levels read as "forest" (deep), evaluation reads as "plum", everything else falls back to "ochre" (the streak/retention voice).
Implementation
factory Milestone.fromMasteryTransition({
required DateTime date,
required String topicTitle,
required String mastery,
}) {
final level = masteryLevelFromString(mastery);
final tone = switch (level) {
5 => MilestoneTone.forest,
4 => MilestoneTone.plum,
_ => MilestoneTone.ochre,
};
return Milestone(date: date, level: level, detail: topicTitle, tone: tone);
}