# Task 1: AI Training Evaluation Persistence Report ## Delivered - Added `docs/sql/2026-07-16-ai-training-evaluation.sql`. - Creates `ai_training_evaluation` with a unique `(student_user_id, teaching_class_id, task_id)` key. - Persists independent help and assessment statuses, task/answer snapshots, reports, raw model responses, model names, completion times, errors, and assessment score. - Adds nullable `student_training_answer.ai_assessment_score`. - Added `AiTrainingEvaluation`, `AiTrainingEvaluationMapper`, and its MyBatis XML mapping. - `findByStudentClassAndTask` retrieves the sole evaluation record for a student, teaching class, and task. - `insertIgnore` safely creates the record under concurrent requests. - `claimHelp` and `claimAssessment` transition only `NOT_STARTED` or `FAILED` rows to `PROCESSING`. - Completion and failure operations update only rows currently in `PROCESSING`. - Added `aiAssessmentScore` to `StudentTrainingAnswer`, its XML result/column/dynamic insert/dynamic update mappings, and `updateAiAssessmentScore` for a targeted score write-back. - Added the assessment score column to the fresh `student_training_answer` table DDL in `StudentTrainingAnswerServiceImpl`. ## Test-first evidence 1. Added `AiTrainingEvaluationServiceImplTest` before implementation. 2. Ran `mvn -Dtest=AiTrainingEvaluationServiceImplTest test` before production changes. - Expected RED result: test compilation failed because `AiTrainingEvaluation` and `AiTrainingEvaluationMapper` did not exist. 3. Implemented the persistence files and re-ran the same targeted Maven test. - GREEN result: 3 tests run; 0 failures; 0 errors; 0 skipped. ## Verification notes - `git diff --check` completed without whitespace errors. - Maven emitted existing project-model warnings about local Aspose `systemPath` dependencies and the relocated MySQL connector artifact. They do not originate from this task and did not prevent compilation or the targeted test from succeeding.