Repository navigation
Order the difficulty filter from Easy to Hard - #287
Merged
Merged
Conversation
jserv
reviewed
Oct 12, 2026
Pandamachi
force-pushed
the
order-difficulty-filter
branch
from
October 12, 2026 04:04
2f884ad to
a053405
Compare
ColtenOuO
reviewed
Oct 12, 2026
ColtenOuO
left a comment
Collaborator
There was a problem hiding this comment.
Overall, the behavior looks good to me, but I have a few thoughts on the newly added comment.
The progress panel's Difficulty menu is built from the distinct difficulties in the saved history, and the helper that collects them sorted with no comparator, so the strings decided the order and Hard came out between Easy and Medium, leaving the menu reading differently from the difficulty checkboxes beside it. Ordering by position in LEVELS keeps the scale defined once, in web/problem-picker.js, which this module already imports to decide which difficulties it will admit at all; a literal order written here would be a second copy to keep in step. The existing options test used only Easy and Medium, whose alphabetical and scale orders agree, so it passed either way, and the case added beside it carries all three levels. Closes sysprog21#281
Pandamachi
force-pushed
the
order-difficulty-filter
branch
from
October 13, 2026 03:07
a053405 to
1f5a993
Compare
Contributor
|
Thank @Pandamachi for contributing! |
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 Difficulty select in the lobby's progress panel listed its options as All, Easy, Hard, Medium and now reads All, Easy, Medium, Hard, with the rest of the detail in #281.
The comparator orders by position in
LEVELS, whichweb/problem-picker.jsexports and which this module already imports to decide which difficulties it will admit at all. Reusing that array keeps the scale defined once; an order written out in the comparator would be a second copy to keep in step with the picker. The duration menu on the next line already passes a comparator, so this is the shape the helper was written for rather than a parameter added for it.The existing test "filter options are deduplicated, ordered, and free of unreadable values" used only Easy and Medium, whose alphabetical and scale orders agree, so it passed either way and left the comparator unpinned. The case added beside it passes
buildProgressModelthree records whose difficulties are Hard, Easy and Medium and assertsoptions.difficultyis["Easy", "Medium", "Hard"]. Run against the parent commit it fails with["Easy", "Hard", "Medium"], which is the reported symptom../scripts/test.shexits 0 on this branch, no lane failed, and the node browser suite reports 1042 tests with 858 passing and 0 failing.make indentis clean and leaves the two changed files as they are.That run left several lanes unchecked, so they are CI's to confirm rather than mine: 184 node browser tests skipped for want of Playwright Chromium, a built server binary and javac, plus the
cargo-audit,actionlint,ruffandshellchecklanes, and the formatter chain skippedruffandshfmt. The menu was not watched in a running lobby either; the list is computed inweb/progress.jsbefore the page renders it, which is the function the new test calls directly.Closes #281
Summary by cubic
Orders the difficulty filter in the lobby's progress panel by the game's level scale instead of alphabetically, so the menu now shows All, Easy, Medium, Hard rather than All, Easy, Hard, Medium.
The comparator reuses the
LEVELSarray fromweb/problem-picker.js, whichweb/progress.jsalready imports to decide which difficulties to allow, so the scale stays defined once. A new test covers all three levels because Easy and Medium sort the same either way, so the existing test could not catch the bug.Closes #281.
Written for commit 1f5a993. Summary will update on new commits.