chordsCourseUse function

CourseUse? chordsCourseUse(
  1. QuestionRound round, {
  2. required String id,
  3. required String title,
  4. required int accuracy,
})

play-chord com as cifras da rodada, na ordem, e o tempo limite do passo (time-limit, se houver). A posição e a inversão ficam como o formato as define por padrão.

Implementation

CourseUse? chordsCourseUse(
  QuestionRound round, {
  required String id,
  required String title,
  required int accuracy,
}) {
  final targets = _chordsOf(round);
  if (targets == null) return null;
  final limit = round.timeLimit;
  final hands = {for (final t in targets) t.hands};
  final block = _block([
    'id: $id',
    'type: play-chord',
    'title: $title',
    'chords: [${targets.map((t) => t.symbol).join(', ')}]',
    if (hands.length == 1 && hands.single == ChordHands.right) 'hand: right',
    'pass: {accuracy: $accuracy${limit == null ? '' : ', time-limit: $limit'}}',
  ]);
  return CourseUse(
    text: block,
    notes: const [
      'As cifras são as desta rodada. Cada vez que o aluno abrir o exercício, '
          'o app sorteia outras do mesmo passo.',
    ],
  );
}