Loading static/js/exercises.api.mjs +14 −0 Changes for static/js/exercises.api.mjs: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -59,6 +59,20 @@ class Exercise { onVerified(handler) { this.#context._verifyHandler = handler } /** * Get if the exercise is solved in the given current state */ isSolved(currentState) { return currentState.solvedExercises.includes(this.index) } /** * Get if the exercise is current in the given current state */ isCurrent(currentState) { return currentState.exerciseIndex === this.index } } /** Loading static/js/yalikejazz.mjs +2 −3 Changes for static/js/yalikejazz.mjs: 2 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -10,13 +10,12 @@ import { createExerciseCard, displayAsSolved, displayAsNonCurrent, displayAsCurr */ function createAndInitExerciseCard(exercise) { const cardEl = createExerciseCard(exercise, () => { if (!currentState.solvedExercises.includes(exercise.index) && currentState.exerciseIndex !== exercise.index) { // Only skip to exercises that are not solved and aren't itself if (!exercise.isSolved(currentState) && !exercise.isCurrent(currentState)) { startExercise(exercise) } }) if (currentState.solvedExercises.includes(exercise.index)) { if (exercise.isSolved(currentState)) { displayAsSolved(cardEl) } Loading Loading
static/js/exercises.api.mjs +14 −0 Changes for static/js/exercises.api.mjs: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -59,6 +59,20 @@ class Exercise { onVerified(handler) { this.#context._verifyHandler = handler } /** * Get if the exercise is solved in the given current state */ isSolved(currentState) { return currentState.solvedExercises.includes(this.index) } /** * Get if the exercise is current in the given current state */ isCurrent(currentState) { return currentState.exerciseIndex === this.index } } /** Loading
static/js/yalikejazz.mjs +2 −3 Changes for static/js/yalikejazz.mjs: 2 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -10,13 +10,12 @@ import { createExerciseCard, displayAsSolved, displayAsNonCurrent, displayAsCurr */ function createAndInitExerciseCard(exercise) { const cardEl = createExerciseCard(exercise, () => { if (!currentState.solvedExercises.includes(exercise.index) && currentState.exerciseIndex !== exercise.index) { // Only skip to exercises that are not solved and aren't itself if (!exercise.isSolved(currentState) && !exercise.isCurrent(currentState)) { startExercise(exercise) } }) if (currentState.solvedExercises.includes(exercise.index)) { if (exercise.isSolved(currentState)) { displayAsSolved(cardEl) } Loading