feat(final-docs): decouple grand-final docs from LIVE_FINAL being ROUND_ACTIVE
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m44s
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m44s
The Grand Final round = the live event; document upload + judge review happen
in the lead-up BEFORE it opens. So gate them on finalist enrollment + the round
being open-for-docs (DRAFT or ACTIVE, not closed/finalized) instead of requiring
ROUND_ACTIVE. Lets the round stay DRAFT until event time.
- getOpenFinaleRound (was getActiveFinaleRound): status in {DRAFT,ACTIVE}, not finalized
- cron + userCanReviewFinals use the same open-status condition
- getUploadUrl + deleteFile allow a not-yet-closed LIVE_FINAL round
- getMyDashboard openRounds includes the enrolled DRAFT LIVE_FINAL round (finalists only)
- tests: DRAFT now works; CLOSED returns null
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,7 @@ import { BUCKET_NAME, generateObjectKey } from '@/lib/minio'
|
||||
const programIds: string[] = []
|
||||
|
||||
async function makeFinaleProgram(
|
||||
opts: { roundStatus?: 'ROUND_ACTIVE' | 'ROUND_DRAFT'; closeAt?: Date; skipRequirements?: boolean } = {},
|
||||
opts: { roundStatus?: 'ROUND_ACTIVE' | 'ROUND_DRAFT' | 'ROUND_CLOSED'; closeAt?: Date; skipRequirements?: boolean } = {},
|
||||
) {
|
||||
const program = await createTestProgram()
|
||||
programIds.push(program.id)
|
||||
@@ -93,11 +93,20 @@ describe('getFinalDocumentStatusForProject', () => {
|
||||
expect(status!.allRequiredUploaded).toBe(true)
|
||||
})
|
||||
|
||||
it('returns null when the LIVE_FINAL round is not active', async () => {
|
||||
it('works when the LIVE_FINAL round is DRAFT (pre-event — documents open before the round opens)', async () => {
|
||||
const { program, round } = await makeFinaleProgram({ roundStatus: 'ROUND_DRAFT' })
|
||||
const project = await createTestProject(program.id)
|
||||
await createTestProjectRoundState(project.id, round.id)
|
||||
const status = await getFinalDocumentStatusForProject(prisma, project.id)
|
||||
expect(status).not.toBeNull()
|
||||
expect(status!.roundId).toBe(round.id)
|
||||
})
|
||||
|
||||
it('returns null when the LIVE_FINAL round is CLOSED', async () => {
|
||||
const { program, round } = await makeFinaleProgram({ roundStatus: 'ROUND_CLOSED' })
|
||||
const project = await createTestProject(program.id)
|
||||
await createTestProjectRoundState(project.id, round.id)
|
||||
const status = await getFinalDocumentStatusForProject(prisma, project.id)
|
||||
expect(status).toBeNull()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user