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 @@ -78,6 +78,20 @@ class Exercise { isCurrent(currentState) { return currentState.exerciseIndex === this.index } /** * Marks this exercise as solved, modifying the given current state */ markAsSolved(currentState) { currentState.markAsSolved(this.index) } /** * Marks this exercise as current, modifying the given current state */ markAsCurrent(currentState) { currentState.exerciseIndex = this.index } } /** Loading static/js/yalikejazz.mjs +2 −2 Changes for static/js/yalikejazz.mjs: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -39,12 +39,12 @@ function initExerciseList() { function startExercise(exercise) { const cardEl = document.querySelector(`.exercise[data-exercise-index='${exercise.index}']`) currentState.exerciseIndex = exercise.index exercise.markAsCurrent(currentState) exercise.onDescribed(description => cardEl.querySelector(".description").textContent = description) exercise.onVerified( success => { if (success) { currentState.markAsSolved(exercise.index) exercise.markAsSolved(currentState) displayAsSolved(cardEl) const nextExercise = currentTest.getNextUnsolvedExercise(currentState) 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 @@ -78,6 +78,20 @@ class Exercise { isCurrent(currentState) { return currentState.exerciseIndex === this.index } /** * Marks this exercise as solved, modifying the given current state */ markAsSolved(currentState) { currentState.markAsSolved(this.index) } /** * Marks this exercise as current, modifying the given current state */ markAsCurrent(currentState) { currentState.exerciseIndex = this.index } } /** Loading
static/js/yalikejazz.mjs +2 −2 Changes for static/js/yalikejazz.mjs: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -39,12 +39,12 @@ function initExerciseList() { function startExercise(exercise) { const cardEl = document.querySelector(`.exercise[data-exercise-index='${exercise.index}']`) currentState.exerciseIndex = exercise.index exercise.markAsCurrent(currentState) exercise.onDescribed(description => cardEl.querySelector(".description").textContent = description) exercise.onVerified( success => { if (success) { currentState.markAsSolved(exercise.index) exercise.markAsSolved(currentState) displayAsSolved(cardEl) const nextExercise = currentTest.getNextUnsolvedExercise(currentState) Loading