Feature: Generate alumni candidates during election handoff by graduation month #502
Labels
No labels
accessibility
api
auth.js
backend
copy
database
defect
dependencies
design
discussion
documentation
duplicate
enhancement
epic
feature
front-end
good first issue
help wanted
invalid
next.js
noscript
on hold
operations
optimization
postgresql
prisma
prototype
question
react
spike
stale
story
tailwind
vulnerability
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
SSE/WebsiteTheSSEquel#502
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Auto-generated alumni review rows currently appear from profile/sign-in activity, not from the election handoff flow.
Current behavior:
next/lib/services/alumniCandidateService.tscreates anAlumniCandidatewhenhasTermPassed(graduationTerm, graduationYear)is truemaybeCreateAlumniCandidate()runs fromnext/lib/authOptions.tson sign-inmaybeCreateAlumniCandidate()also runs fromnext/app/api/user/route.tsafter profile updatesThat means a pending alumni review can appear just because a user signs in or edits their profile after their graduation term has passed. The desired behavior is narrower: auto-generated alumni requests should appear only as part of the end-of-election / new-semester handoff when the graduating student is in the graduation month/year associated with that election cycle.
Example: if a student graduates in May 2026, then clicking the end-of-election / send-invites button for the May 2026 election cycle should generate their automatic alumni review row.
Proposed Solution
Move automatic alumni candidate generation into the post-election handoff flow.
Likely trigger point:
POST /api/elections/[id]/send-officer-invites, used bynext/app/(main)/dashboard/new-semester/[electionId]/NewSemesterClient.tsxwhen SE Office clicks Send invitesIf the product flow changes to combine certification, new-semester start, and invite dispatch into a single end-election action, put the alumni generation in that single orchestrator instead. The key requirement is that the generation happens from the election-cycle handoff button, not from normal sign-in/profile-update side effects.
Eligibility Rule
Create an auto alumni candidate only when both are true:
Suggested election-cycle date source:
Election.votingCloseAtorElection.certifiedAtas the election-cycle reference date, and document the chosen source(graduationMonth, graduationYear)to that reference month/yearImportant current-data note: the schema currently stores
graduationTermandgraduationYear, not a precise graduation month. This issue should either add agraduationMonthfield or explicitly define a reliable term-to-month mapping before implementing the month/year check.Scope
In scope:
AlumniCandidaterows only for users whose graduation month/year matches the election-cycle reference month/yearAlumnirecord or an existing candidateOut of scope:
Acceptance Criteria
Alumnirecord are ignoredAlumniCandidateare ignoredAdditional Context
Relevant existing files:
next/lib/services/alumniCandidateService.tsnext/lib/authOptions.tsnext/app/api/user/route.tsnext/app/api/elections/[id]/send-officer-invites/route.tsnext/app/(main)/dashboard/new-semester/[electionId]/NewSemesterClient.tsx