fix: scope analytics assignments to selected round
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m38s
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m38s
getProjectRankings and getAllProjects in the analytics router were loading every assignment for each project regardless of the selected round, so per-round rankings in the admin reports were counting evaluations from prior rounds and mixing their scores into averages. A Round 2 view with 3 reviews per project was showing 5 evaluations and a skewed average that included Round 1 data. Filter the nested assignments include by the round (or program) the request is scoped to, matching the pattern already used by the ranking service and by getStatusBreakdown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -198,6 +198,7 @@ export const analyticsRouter = router({
|
|||||||
teamName: true,
|
teamName: true,
|
||||||
status: true,
|
status: true,
|
||||||
assignments: {
|
assignments: {
|
||||||
|
where: assignmentWhere(input),
|
||||||
select: {
|
select: {
|
||||||
evaluation: {
|
evaluation: {
|
||||||
select: { criterionScoresJson: true, status: true },
|
select: { criterionScoresJson: true, status: true },
|
||||||
@@ -1072,6 +1073,7 @@ export const analyticsRouter = router({
|
|||||||
logoKey: true,
|
logoKey: true,
|
||||||
logoProvider: true,
|
logoProvider: true,
|
||||||
assignments: {
|
assignments: {
|
||||||
|
where: input.roundId ? { roundId: input.roundId } : undefined,
|
||||||
select: {
|
select: {
|
||||||
roundId: true,
|
roundId: true,
|
||||||
round: { select: { id: true, name: true, sortOrder: true } },
|
round: { select: { id: true, name: true, sortOrder: true } },
|
||||||
|
|||||||
Reference in New Issue
Block a user