fix(assignments): make reshuffle concurrency-safe; preserve juryGroupId
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m16s

This commit is contained in:
Matt
2026-02-20 03:48:17 +01:00
parent c7f20e2f32
commit d9d6a63e4a
3 changed files with 103 additions and 25 deletions

View File

@@ -15,6 +15,7 @@ import type {
CompetitionStatus,
ProjectRoundStateValue,
AssignmentMethod,
EvaluationStatus,
} from '@prisma/client'
export function uid(prefix = 'test'): string {
@@ -176,6 +177,7 @@ export async function createTestAssignment(
overrides: Partial<{
method: AssignmentMethod
isCompleted: boolean
juryGroupId: string
}> = {},
) {
return prisma.assignment.create({
@@ -185,6 +187,29 @@ export async function createTestAssignment(
roundId,
method: overrides.method ?? 'MANUAL',
isCompleted: overrides.isCompleted ?? false,
juryGroupId: overrides.juryGroupId ?? undefined,
},
})
}
// ─── Evaluation Factory ───────────────────────────────────────────────────
export async function createTestEvaluation(
assignmentId: string,
formId: string,
overrides: Partial<{
status: 'NOT_STARTED' | 'DRAFT' | 'SUBMITTED' | 'LOCKED'
globalScore: number
submittedAt: Date
}> = {},
) {
return prisma.evaluation.create({
data: {
assignmentId,
formId,
status: overrides.status ?? 'NOT_STARTED',
globalScore: overrides.globalScore ?? null,
submittedAt: overrides.submittedAt ?? null,
},
})
}