Fix AI assignment errors and tag matching
Build and Push Docker Image / build (push) Successful in 9m7s Details

- Add missing updatedAt column to AssignmentJob table
- Fix algorithmic assignment to use AI-assigned projectTags instead of raw CSV tags
- Add case-insensitive tag matching for better expertise matching
- Scores should now properly reflect tag matches between judges and projects

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt 2026-02-05 14:14:19 +01:00
parent fbb1173ea9
commit e3e3fa9da4
2 changed files with 28 additions and 5 deletions

View File

@ -0,0 +1,11 @@
-- Add missing updatedAt column to AssignmentJob table
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_name = 'AssignmentJob' AND column_name = 'updatedAt'
) THEN
ALTER TABLE "AssignmentJob" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
END IF;
END $$;

View File

@ -613,6 +613,9 @@ export const assignmentRouter = router({
id: true, id: true,
title: true, title: true,
tags: true, tags: true,
projectTags: {
include: { tag: { select: { name: true } } },
},
_count: { select: { assignments: true } }, _count: { select: { assignments: true } },
}, },
}) })
@ -656,13 +659,22 @@ export const assignmentRouter = router({
const reasoning: string[] = [] const reasoning: string[] = []
let score = 0 let score = 0
// Expertise match (35% weight) // Expertise match (35% weight) - use AI-assigned projectTags if available
const matchingTags = juror.expertiseTags.filter((tag) => const projectTagNames = project.projectTags.map((pt) => pt.tag.name.toLowerCase())
project.tags.includes(tag)
) // Match against AI-assigned tags first, fall back to raw tags
const matchingTags = projectTagNames.length > 0
? juror.expertiseTags.filter((tag) =>
projectTagNames.includes(tag.toLowerCase())
)
: juror.expertiseTags.filter((tag) =>
project.tags.map((t) => t.toLowerCase()).includes(tag.toLowerCase())
)
const totalTags = projectTagNames.length > 0 ? projectTagNames.length : project.tags.length
const expertiseScore = const expertiseScore =
matchingTags.length > 0 matchingTags.length > 0
? matchingTags.length / Math.max(project.tags.length, 1) ? matchingTags.length / Math.max(totalTags, 1)
: 0 : 0
score += expertiseScore * 35 score += expertiseScore * 35
if (matchingTags.length > 0) { if (matchingTags.length > 0) {