fix: missing team report system#492
Conversation
ReehalS
left a comment
There was a problem hiding this comment.
Looked this over, changes look good, @hadiafifah I assume you've tested this already, if you want me to do the full flow testing as well lmk.
|
When teams are to be marked present, also mark the team's |
There was a problem hiding this comment.
Pull request overview
Adds an admin-only recovery flow for “missing team” reports so admins can mark a reported team as present, re-queue it for only the reporting judges who still have an unscored submission, and clear the missing reports.
Changes:
- Added
restoreMissingTeam(team_id)server action with admin authorization, selective re-queuing, and report clearing. - Updated Admin Teams UI to surface a “Mark Team as Present” action on reported teams with confirmation + loading state.
- Added Jest tests covering
reportMissingProjectand the newrestoreMissingTeambehavior.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| package-lock.json | Lockfile updates (peer metadata changes). |
| app/(pages)/admin/teams/page.tsx | Wires the new restore action into the admin teams page, including confirmation and refresh. |
| app/(pages)/admin/_components/Teams/TeamCard.tsx | Adds a per-team “Mark Team as Present” button and disables it while restoring. |
| app/(pages)/admin/_components/Teams/TeamCard.module.scss | Styles for the new restore button and helper text. |
| app/(api)/_actions/teams/reportMissingTeam.ts | Implements restoreMissingTeam server action: admin-gated, dedupes reporting judges, requeues unscored submissions, clears reports, reactivates team. |
| tests/actions/reportMissingTeam.test.ts | New unit tests for missing-report and restore flows using mocked datalib/auth. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const reorderResList = await Promise.all( | ||
| reorderedSubmissions.map((sub: Submission) => | ||
| UpdateSubmission(sub.judge_id, sub.team_id, { | ||
| $set: { queuePosition: sub.queuePosition }, | ||
| }) | ||
| ) | ||
| ); | ||
|
|
||
| if (!reorderResList.every((res: any) => res.ok)) { | ||
| throw new Error( | ||
| `Not all submission order updates succeeded\n${JSON.stringify( | ||
| reorderResList | ||
| )}` | ||
| ); | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
b79fd91 to
d910011
Compare
|
Note: Accidentally asked copolit for fix, but I undid the commit |
Summary
This PR adds an admin recovery flow for missing teams: admins can now mark a team as present and restore it back to relevant judges’ queues.
What Changed
Backend
restoreMissingTeam(team_id)in the teams missing-report action module.is_scored === false.team.active = true.Admin UI (/admin/teams)
Behavior Notes
Fixes #466