fix: scope admin ranking dashboard side-sheet stats to current round
The admin dashboard fetches its side-sheet detail from project.getFullDetail (not analytics.getProjectDetail as the audit assumed), and that procedure had the same cross-round contamination bug. Add an optional roundId to its input, filter the SUBMITTED-evaluations query when provided, and pass roundId from the dashboard's useQuery so the Avg Score / Pass Rate / Evaluators card now matches the per-juror list rendered below it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
createTestEvaluation, createTestEvaluationForm, cleanupTestData, uid,
|
||||
} from '../helpers'
|
||||
import { analyticsRouter } from '../../src/server/routers/analytics'
|
||||
import { projectRouter } from '../../src/server/routers/project'
|
||||
|
||||
describe('analytics.getProjectDetail round scoping', () => {
|
||||
let programId: string
|
||||
@@ -69,6 +70,15 @@ describe('analytics.getProjectDetail round scoping', () => {
|
||||
const result = await caller.getProjectDetail({ id: projectId })
|
||||
expect(result.stats!.totalEvaluations).toBe(5)
|
||||
})
|
||||
|
||||
it('project.getFullDetail also scopes stats to roundId when provided', async () => {
|
||||
const caller = createCaller(projectRouter, admin)
|
||||
const scoped = await caller.getFullDetail({ id: projectId, roundId: roundBId })
|
||||
expect(scoped.stats!.totalEvaluations).toBe(3)
|
||||
expect(scoped.stats!.averageGlobalScore).toBeCloseTo(8.333, 2)
|
||||
const aggregate = await caller.getFullDetail({ id: projectId })
|
||||
expect(aggregate.stats!.totalEvaluations).toBe(5)
|
||||
})
|
||||
})
|
||||
|
||||
describe('analytics.getProjectRankings per-round z-context (edition mode)', () => {
|
||||
|
||||
Reference in New Issue
Block a user