Skip to content

Fix off-by-one chapter number in the dashboard TOC#32

Merged
mre merged 1 commit into
mainfrom
fix-dashboard-toc-number
Jun 21, 2026
Merged

Fix off-by-one chapter number in the dashboard TOC#32
mre merged 1 commit into
mainfrom
fix-dashboard-toc-number

Conversation

@mre

@mre mre commented Jun 21, 2026

Copy link
Copy Markdown
Member

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 set ExerciseProgress.number = ex.number + 1. But ex.number is already the 1-based display number (assigned as a running ordinal in scan_dir), so the + 1 double-counted. The other code paths (ProgressDot in the picker and the exercise page) already use ex.number directly, which is why they disagreed.

Dropping the + 1 makes 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.

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.
@mre mre merged commit f6c8f6f into main Jun 21, 2026
4 checks passed
@mre mre deleted the fix-dashboard-toc-number branch June 21, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant