Fix stale session redirect loop, filtering stats to reflect overrides
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m56s
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m56s
- Auth layout verifies user exists in DB before redirecting to dashboard, breaking infinite loop for deleted accounts with stale sessions - Jury/Mentor layouts handle null user (deleted) by redirecting to login - Filtering stats cards and result list now use effective outcome (finalOutcome ?? outcome) instead of raw AI outcome - Award eligibility evaluation includes admin-overridden PASSED projects - Award shortlist reasoning column shows full text instead of truncating Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -855,7 +855,13 @@ export const filteringRouter = router({
|
||||
const skip = (page - 1) * perPage
|
||||
|
||||
const where: Record<string, unknown> = { roundId }
|
||||
if (outcome) where.outcome = outcome
|
||||
if (outcome) {
|
||||
// Filter by effective outcome (finalOutcome if overridden, otherwise original outcome)
|
||||
where.OR = [
|
||||
{ finalOutcome: outcome },
|
||||
{ finalOutcome: null, outcome },
|
||||
]
|
||||
}
|
||||
|
||||
const [results, total] = await Promise.all([
|
||||
ctx.prisma.filteringResult.findMany({
|
||||
@@ -896,15 +902,34 @@ export const filteringRouter = router({
|
||||
getResultStats: protectedProcedure
|
||||
.input(z.object({ roundId: z.string() }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
// Use effective outcome (finalOutcome if overridden, otherwise original outcome)
|
||||
const [passed, filteredOut, flagged, overridden] = await Promise.all([
|
||||
ctx.prisma.filteringResult.count({
|
||||
where: { roundId: input.roundId, outcome: 'PASSED' },
|
||||
where: {
|
||||
roundId: input.roundId,
|
||||
OR: [
|
||||
{ finalOutcome: 'PASSED' },
|
||||
{ finalOutcome: null, outcome: 'PASSED' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
ctx.prisma.filteringResult.count({
|
||||
where: { roundId: input.roundId, outcome: 'FILTERED_OUT' },
|
||||
where: {
|
||||
roundId: input.roundId,
|
||||
OR: [
|
||||
{ finalOutcome: 'FILTERED_OUT' },
|
||||
{ finalOutcome: null, outcome: 'FILTERED_OUT' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
ctx.prisma.filteringResult.count({
|
||||
where: { roundId: input.roundId, outcome: 'FLAGGED' },
|
||||
where: {
|
||||
roundId: input.roundId,
|
||||
OR: [
|
||||
{ finalOutcome: 'FLAGGED' },
|
||||
{ finalOutcome: null, outcome: 'FLAGGED' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
ctx.prisma.filteringResult.count({
|
||||
where: { roundId: input.roundId, overriddenBy: { not: null } },
|
||||
|
||||
@@ -59,9 +59,15 @@ export async function processEligibilityJob(
|
||||
}>
|
||||
|
||||
if (filteringRoundId) {
|
||||
// Scope to projects that PASSED filtering in the specified round
|
||||
// Scope to projects that effectively PASSED filtering (including admin overrides)
|
||||
const passedResults = await prisma.filteringResult.findMany({
|
||||
where: { roundId: filteringRoundId, outcome: 'PASSED' },
|
||||
where: {
|
||||
roundId: filteringRoundId,
|
||||
OR: [
|
||||
{ finalOutcome: 'PASSED' },
|
||||
{ finalOutcome: null, outcome: 'PASSED' },
|
||||
],
|
||||
},
|
||||
select: { projectId: true },
|
||||
})
|
||||
const passedIds = passedResults.map((r) => r.projectId)
|
||||
|
||||
Reference in New Issue
Block a user