Fix off-by-one chapter number in the dashboard TOC#32
Merged
Conversation
ExerciseProgress.number added 1 to ex.number, but ex.number is already the 1-based display ordinal (assigned in scan_dir). That made the dashboard/admin/team chapter lists show a number one higher than the exercise pages and the chapter picker, which use ex.number directly. Drop the spurious + 1 so all of them agree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The dashboard, admin, and team chapter lists were showing chapter numbers one higher than the exercise pages and the chapter picker.
The cause was in
get_exercise_progress: it setExerciseProgress.number = ex.number + 1. Butex.numberis already the 1-based display number (assigned as a running ordinal inscan_dir), so the+ 1double-counted. The other code paths (ProgressDotin the picker and the exercise page) already useex.numberdirectly, which is why they disagreed.Dropping the
+ 1makes everything use the same number.This is the small standalone fix that was noted but deferred during the bonus-chapter work (PR C). Branched off
main, independent of the restructure PR. Build, clippy, and tests pass.