masteryIntFromLabel static method

int masteryIntFromLabel(
  1. String mastery
)

Maps a mastery label to its 0..5 index on the ramp. The synthetic 'in_progress' state returns 0 — callers that want the parent-rollup appearance should pass inProgress: true to MasteryRing instead.

Implementation

static int masteryIntFromLabel(String mastery) {
  return switch (mastery) {
    'awareness' => 1,
    'understanding' => 2,
    'application' => 3,
    'evaluation' => 4,
    'mastery' => 5,
    _ => 0,
  };
}