[codex] Fix later-round scorecard generation#120
Merged
jonatanklosko merged 2 commits intoMay 3, 2026
Conversation
jonatanklosko
approved these changes
May 3, 2026
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.
What changed
This PR was generated entirely by AI assistance.
It fixes later-round scorecard generation when a round already has competitor assignments but the WCIF does not yet have populated result scaffolding for that round.
The functional changes are:
resultsarrays as needing scorecardspersons[].assignmentswhen those assignments exist, instead of falling back to blank nameless cardsWhy these code changes were needed
src/logic/activities.jsroundsMissingScorecards()now evaluates all rounds through a small helper instead of relying onroundsMissingResults().I made that change because
roundsMissingResults()was too narrow for this case. A later round can already have assignments and still have an emptyresultsarray. In that state, we still want the round to show up as scorecard-ready.The new helper keeps the rule explicit:
src/logic/documents/scorecards.jsgroupActivitiesWithCompetitors()now builds the group list before deciding whether it can derive competitors from results.I made that change because the old flow only had one source of truth for later rounds:
competitorsForRound(). That works when the WCIF already has the expected round/result scaffolding, but it fails when assignments exist before those result rows are populated.The new flow adds a second path:
wcif.persons[].assignmentsfor competitor assignments in each groupThat is why the diff in
scorecards.jsis larger than a simple condition change. This fix needed a real assignment-based path, not just a different boolean.The direct assignment path also sorts competitors in a stable order. It prefers known round ordering when available, then station number, then name. I added that so printing stays consistent and readable even when round rankings are not available yet.
scorecards()is now exported so the regression test can exercise the actual scorecard-generation path directly.Impact
Validation
yarn test --watch=false --runInBand src/logic/tests/activities.test.js src/logic/tests/scorecards.test.js src/logic/tests/competitors.test.js src/components/App/App.test.js src/components/Header/Header.test.js src/components/CompetitionList/CompetitionList.test.js src/logic/tests/formatters.test.js