Fix AI suggestions not displaying after job completion

BREAKING CHANGE: AI assignment job now stores suggestions in database

- Add suggestionsJson column to AssignmentJob table
- Store enriched suggestions when job completes
- Update getAISuggestions to retrieve stored suggestions instead of regenerating
- Filter out already-assigned pairs from stored suggestions

Previously, the background job generated suggestions but discarded them,
and getAISuggestions tried to regenerate from scratch (causing infinite loading).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 14:38:43 +01:00
parent e3e3fa9da4
commit 3abfccb22a
3 changed files with 73 additions and 76 deletions

View File

@@ -0,0 +1,11 @@
-- Add suggestionsJson column to AssignmentJob to store AI-generated suggestions
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_name = 'AssignmentJob' AND column_name = 'suggestionsJson'
) THEN
ALTER TABLE "AssignmentJob" ADD COLUMN "suggestionsJson" JSONB;
END IF;
END $$;