Skip to content

fix(practice): route finalized contest problems to Contest Questions - #130

Merged
codenamed22 merged 1 commit into
mainfrom
fix/hireup-problems-in-contest-questions
Aug 13, 2026
Merged

codenamed22 merged 1 commit into
mainfrom
fix/hireup-problems-in-contest-questions

Conversation

@codenamed22

Copy link
Copy Markdown
Owner

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.tsx decided whether a problem was a contest question purely by looking for a "Contest" string in its tags array:

const contestProblems = problems.filter((problem) => problem.tags.includes("Contest"));
const weekProblems = problems.filter((problem) => !problem.tags.includes("Contest"));

Regular contest problems get that tag at seed time in prisma/contest-problem-set.js, but HireUp problems are tagged ["Uber", "HireUp", ...] in prisma/hireup-problem-set.js. Finalization only flips published: 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 in groupProblemsByWeek, landing in Week 5.

Fix

Key the split off actual contest membership (the contestProblems relation) rather than a tag, keeping the tag check as a fallback:

const isContestProblem = (problem: (typeof problems)[number]) =>
  problem.contestProblems.length > 0 || problem.tags.includes("Contest");

The Prisma query gains a contestProblems: { select: { contestId: true }, take: 1 } selection to support this.

Notes

  • Retroactive — no data migration and no re-finalizing required. Existing tagged contest problems are unaffected since they satisfy both conditions.
  • Any future contest (HireUp or otherwise) now routes correctly regardless of how its problems are tagged.
  • Week numbering re-flows once the three problems leave the week buckets.

Testing

  • Typecheck clean
  • Reload /problems and confirm the three HireUp problems appear under Contest Questions

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.
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shardup-site Ready Ready Preview Aug 13, 2026 6:22pm

@codenamed22
codenamed22 merged commit d30d650 into main Aug 13, 2026
4 checks passed
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