Retroactive auto-PASS for projects with complete documents
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m14s
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m14s
Wire batchCheckRequirementsAndTransition into round activation and reopen so pre-existing projects that already have all required docs get auto- passed. Also adds checkDocumentCompletion endpoint for manual sweeps on already-active rounds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -263,4 +263,41 @@ export const roundEngineRouter = router({
|
||||
|
||||
return { success: true, removedCount: deleted.count }
|
||||
}),
|
||||
|
||||
/**
|
||||
* Retroactive document check: auto-PASS any PENDING/IN_PROGRESS projects
|
||||
* that already have all required documents uploaded for this round.
|
||||
* Useful for rounds activated before the auto-transition feature was deployed.
|
||||
*/
|
||||
checkDocumentCompletion: adminProcedure
|
||||
.input(z.object({ roundId: z.string() }))
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const { batchCheckRequirementsAndTransition } = await import('../services/round-engine')
|
||||
|
||||
const projectStates = await ctx.prisma.projectRoundState.findMany({
|
||||
where: {
|
||||
roundId: input.roundId,
|
||||
state: { in: ['PENDING', 'IN_PROGRESS'] },
|
||||
},
|
||||
select: { projectId: true },
|
||||
})
|
||||
|
||||
if (projectStates.length === 0) {
|
||||
return { transitionedCount: 0, checkedCount: 0, projectIds: [] }
|
||||
}
|
||||
|
||||
const projectIds = projectStates.map((ps: { projectId: string }) => ps.projectId)
|
||||
const result = await batchCheckRequirementsAndTransition(
|
||||
input.roundId,
|
||||
projectIds,
|
||||
ctx.user.id,
|
||||
ctx.prisma,
|
||||
)
|
||||
|
||||
return {
|
||||
transitionedCount: result.transitionedCount,
|
||||
checkedCount: projectIds.length,
|
||||
projectIds: result.projectIds,
|
||||
}
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user