Loosen group placement lock to the last group match - #5
Merged
Conversation
Previously a group's 1°/2°/3° placement card locked as soon as the first group-stage match between two of its teams kicked off. By matchday 1 every group already shows "Grupo bloqueado", which makes it impossible to refine placement picks as the matchdays unfold even when most fixtures are still in the future. Move the cutoff to the latest per-match-safe point: a group now stays editable while *any* of its group-stage matches is still unlocked, and only locks once every such match has kicked off or been manually closed by an admin. Placement therefore stays a genuine prediction (one fixture is still uncertain when the lock fires) without trivially giving the user the final standings. Per-match locking semantics are unchanged: each individual match still locks at its own kickoff or when admin closes it. The relaxed rule only governs the derived group-level lock. i18n strings updated in en / es / pt / it / nl. ARCHITECTURE §7.5 and QA_CHECKLIST §11.1/§11.2 updated to describe the new cutoff and to add a mixed-state test step. New unit coverage in locking.test.mjs verifies that a partially-started group stays open, that the group locks once every match has started, and that a single admin-closed match no longer locks the whole group on its own. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
By matchday 1 of a tournament, every group already shows "Grupo bloqueado — ya arrancó el primer partido" on the Predict page, which makes it impossible to refine 1°/2°/3° picks as the rest of the group plays out — even though most of those fixtures haven't kicked off yet.
This PR loosens the group-level cutoff to the latest per-match-safe point: a group's placement card stays editable while any of its group-stage matches is still unlocked, and only locks once every such match has kicked off or been manually closed by an admin. Placement still locks before any match has finished, so it stays a genuine prediction — but the user can keep refining picks throughout matchdays 1 and 2.
Per-match locking semantics are unchanged: each individual match still locks at its own kickoff or when admin closes it. Only the derived group-level lock changes.
What changed
api/locking.cjs—isGroupPredictionLockednow requires every group-stage match in the group to be locked before reporting the group as locked; comment + module header updated to describe the new cutoffpredict.groupLockedrewritten in en / es / pt / it / nl to read "last group match kicked off" instead of "first match kicked off" (Spanish: "ya arrancó el último partido del grupo")docs/ARCHITECTURE.md§7.5 — locking rules now describe the per-match-safe cutoff and the consequence for groups containingmatchDate = nullmatchesdocs/QA_CHECKLIST.md§11.1 / §11.2 — manual lock test now explicitly exercises a partially-started group vs. a fully-started group, and the admin closure step calls out that closing one group-stage match no longer locks the whole group on its owntests/locking.test.mjs— three new unit cases:Integrity note
Under the new rule, by the time a group's placement card locks, 5 of the 6 fixtures in a 4-team group have already been played. The final 6th match is still uncertain, so placement remains a prediction. This was the user's explicit preference over the more lenient "lock after all matches finish" option (which would have trivialized the placement scoring).
Test plan
npm run lint— cleannode --test tests/locking.test.mjs— 11/11 pass, including the 3 new casesnpm test— full suite 50/50 pass (verified pre-cherry-pick on the parent branch)Made with Cursor