Fix juror drop: remove from jury group + reassign projects
All checks were successful
Build and Push Docker Image / build (push) Successful in 9m7s
All checks were successful
Build and Push Docker Image / build (push) Successful in 9m7s
The reassignDroppedJuror flow was missing a key step — after reshuffling unsubmitted projects to other jurors, the dropped juror was not removed from the jury group. This meant they could be re-assigned in future assignment runs. Now deletes the JuryGroupMember record after reshuffle, logs removal in audit, and updates the confirmation dialog to reflect the full action. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2376,11 +2376,12 @@ function JuryProgressTable({ roundId }: { roundId: string }) {
|
||||
utils.assignment.listByStage.invalidate({ roundId })
|
||||
utils.roundEngine.getProjectStates.invalidate({ roundId })
|
||||
utils.analytics.getJurorWorkload.invalidate({ roundId })
|
||||
utils.roundAssignment.unassignedQueue.invalidate({ roundId })
|
||||
|
||||
if (data.failedCount > 0) {
|
||||
toast.warning(`Reassigned ${data.movedCount} project(s). ${data.failedCount} could not be reassigned (all remaining jurors at cap/blocked).`)
|
||||
toast.warning(`Dropped juror and reassigned ${data.movedCount} project(s). ${data.failedCount} could not be reassigned (all remaining jurors at cap/blocked).`)
|
||||
} else {
|
||||
toast.success(`Reassigned ${data.movedCount} project(s) evenly across available jurors.`)
|
||||
toast.success(`Dropped juror and reassigned ${data.movedCount} project(s) evenly across available jurors.`)
|
||||
}
|
||||
},
|
||||
onError: (err) => toast.error(err.message),
|
||||
@@ -2452,7 +2453,7 @@ function JuryProgressTable({ roundId }: { roundId: string }) {
|
||||
disabled={reshuffleMutation.isPending}
|
||||
onClick={() => {
|
||||
const ok = window.confirm(
|
||||
`Reassign all unsubmitted projects from ${juror.name} to other jurors within their caps? Submitted and locked evaluations will be preserved. This cannot be undone.`
|
||||
`Remove ${juror.name} from this jury pool and reassign all their unsubmitted projects to other jurors within their caps? Submitted evaluations will be preserved. This cannot be undone.`
|
||||
)
|
||||
if (!ok) return
|
||||
reshuffleMutation.mutate({ roundId, jurorId: juror.id })
|
||||
|
||||
@@ -433,6 +433,19 @@ async function reassignDroppedJurorAssignments(params: {
|
||||
})
|
||||
}
|
||||
|
||||
// Remove the dropped juror from the jury group so they can't be re-assigned
|
||||
// in future assignment runs for this round's competition.
|
||||
let removedFromGroup = false
|
||||
if (round.juryGroupId) {
|
||||
const deleted = await prisma.juryGroupMember.deleteMany({
|
||||
where: {
|
||||
juryGroupId: round.juryGroupId,
|
||||
userId: params.droppedJurorId,
|
||||
},
|
||||
})
|
||||
removedFromGroup = deleted.count > 0
|
||||
}
|
||||
|
||||
if (params.auditUserId) {
|
||||
await logAudit({
|
||||
prisma,
|
||||
@@ -448,6 +461,7 @@ async function reassignDroppedJurorAssignments(params: {
|
||||
failedProjects,
|
||||
skippedProjects,
|
||||
reassignedTo,
|
||||
removedFromGroup,
|
||||
},
|
||||
ipAddress: params.auditIp,
|
||||
userAgent: params.auditUserAgent,
|
||||
|
||||
Reference in New Issue
Block a user