fix(finalization): skip MENTORING rounds in advancement display copy
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m10s

The mentoring round is opt-in (eligibility: requested_only) and only a subset
of advancing teams enter it; the rest auto-pass through. Showing it as the
"next round" in the finalization summary and advancement emails was misleading
since Grand Finale is the shared destination for all advancing teams.

Routing is unchanged — targetRoundId still points to the next round by sortOrder
(may be MENTORING) so opt-in handling is preserved. Only the user-facing label
skips MENTORING.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt
2026-05-05 20:02:35 +02:00
parent 6e36704bb1
commit e8d0bb050f
2 changed files with 45 additions and 15 deletions

View File

@@ -15,6 +15,7 @@ import {
processRoundClose,
getFinalizationSummary,
confirmFinalization,
findDisplayNextRound,
} from '../services/round-finalization'
import {
getAdvancementNotificationTemplate,
@@ -382,14 +383,19 @@ export const roundEngineRouter = router({
select: {
name: true,
competition: {
select: { rounds: { select: { id: true, name: true, sortOrder: true }, orderBy: { sortOrder: 'asc' } } },
select: {
rounds: {
select: { id: true, name: true, sortOrder: true, roundType: true },
orderBy: { sortOrder: 'asc' },
},
},
},
},
})
const rounds = round.competition.rounds
const currentIdx = rounds.findIndex((r) => r.id === input.roundId)
const nextRound = rounds[currentIdx + 1]
const toRoundName = nextRound?.name ?? 'Next Round'
// Skip MENTORING rounds for display — those are opt-in and not the
// shared destination for all advancing teams.
const toRoundName = findDisplayNextRound(rounds, input.roundId)?.name ?? 'Next Round'
const passedCount = await ctx.prisma.projectRoundState.count({
where: { roundId: input.roundId, proposedOutcome: 'PASSED' },