Skip to content

fix: missing team report system#492

Merged
michelleyeoh merged 11 commits intomainfrom
fix/missing-team-report
May 1, 2026
Merged

fix: missing team report system#492
michelleyeoh merged 11 commits intomainfrom
fix/missing-team-report

Conversation

@hadiafifah
Copy link
Copy Markdown
Contributor

@hadiafifah hadiafifah commented Apr 16, 2026

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

  • Added restoreMissingTeam(team_id) in the teams missing-report action module.
  • Enforced admin-only access inside the action (auth() + role check).
  • Restore logic now:
    • Collects unique judge IDs from team.reports.
    • For each reporting judge, requeues the team to the end only if: the submission exists for that judge/team, and is_scored === false.
    • Skips scored submissions (existing judged work is preserved).
    • Sets team.active = true.
    • Clears team.reports after successful processing.

Admin UI (/admin/teams)

  • Added a team-level action button and helper text on reported teams
  • Added confirmation prompt before execution

Behavior Notes

  • Only judges who reported the team missing and still have an unscored submission are requeued.
  • Non-reporting judges are unaffected.
  • Scored submissions are not modified.

Fixes #466

Copy link
Copy Markdown
Member

@ReehalS ReehalS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

@ReehalS ReehalS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add Tests to verify this functionality actually works. (including for code you didn't write for the missing teams functionality), the person who initially wrote this likely fully vibecoded it

@ReehalS
Copy link
Copy Markdown
Member

ReehalS commented Apr 24, 2026

When teams are to be marked present, also mark the team's active=true regardless of what it was before, and move that team back into all of the judges whose queues that team has been marked missing with.

ReehalS
ReehalS previously approved these changes May 1, 2026
Copy link
Copy Markdown
Member

@ReehalS ReehalS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 reportMissingProject and the new restoreMissingTeam behavior.

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.

Comment on lines +177 to +191
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
)}`
);
}
Comment thread app/(api)/_actions/teams/reportMissingTeam.ts
Comment thread app/(api)/_actions/teams/reportMissingTeam.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI requested a review from michelleyeoh May 1, 2026 18:32
@michelleyeoh michelleyeoh force-pushed the fix/missing-team-report branch from b79fd91 to d910011 Compare May 1, 2026 18:36
@HackDavis HackDavis deleted a comment from Copilot AI May 1, 2026
@michelleyeoh
Copy link
Copy Markdown
Contributor

Note: Accidentally asked copolit for fix, but I undid the commit

@michelleyeoh michelleyeoh merged commit 087904e into main May 1, 2026
3 checks passed
@michelleyeoh michelleyeoh deleted the fix/missing-team-report branch May 1, 2026 18:39
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.

Fix missing team report system

5 participants