fix(practice): route finalized contest problems to Contest Questions - #130
Merged
Merged
Conversation
The practice page classified a problem as a contest question only when its tags array contained "Contest". HireUp problems are tagged ["Uber", "HireUp"], so once the HireUp contest was finalized and its problems were published they fell through into the weekly time-budget grouping and showed up under Week 5. Key the split off actual contest membership instead, keeping the tag check as a fallback. This is retroactive, so no data migration or re-finalizing needed.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Problem
After finalizing the HireUp contest, its three problems (Service Call Profiler, Driver Rebalancing Across City Corridors, Best Dispatch Hub) showed up under Week 5 on the practice sheet instead of the Contest Questions section.
Root cause
app/problems/page.tsxdecided whether a problem was a contest question purely by looking for a"Contest"string in itstagsarray:Regular contest problems get that tag at seed time in
prisma/contest-problem-set.js, but HireUp problems are tagged["Uber", "HireUp", ...]inprisma/hireup-problem-set.js. Finalization only flipspublished: true— it never adds the tag. So once the HireUp contest was finalized, its problems became visible, failed the tag check, and got swept into the weekly time-budget grouping ingroupProblemsByWeek, landing in Week 5.Fix
Key the split off actual contest membership (the
contestProblemsrelation) rather than a tag, keeping the tag check as a fallback:The Prisma query gains a
contestProblems: { select: { contestId: true }, take: 1 }selection to support this.Notes
Testing
/problemsand confirm the three HireUp problems appear under Contest Questions