You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.6 KiB

Task 3: AI Training Evaluation Service/API Report

Delivered

  • Added the student-safe AiTrainingEvaluationView, excluding task/answer snapshots, raw model output, and internal failure details.
  • Added AiTrainingEvaluationService and its implementation for evaluation retrieval plus AI help and assessment generation.
    • Requires an authenticated student JWT, resolves the task, active teaching class, and saved answer server-side, and rejects answers whose four steps are blank.
    • Uses the existing atomic aggregate-row mapper transitions: cached success returns the stored report, processing returns state without calling Qwen, and failed evaluations can be claimed again.
    • Persists immutable task (background, objectives, requirements) and four-step answer snapshots only with a successful report.
    • Calls Qwen after the database claim and outside a transaction; validates help schema and assessment score/criteria schema before persistence.
    • Caps persisted failure messages at 1000 characters and updates student_training_answer.ai_assessment_score only after a valid assessment report is persisted.
  • Added the student endpoints:
    • GET /api/student/training-tasks/{taskKey}/ai-evaluation
    • POST /api/student/training-tasks/{taskKey}/ai-evaluation/help
    • POST /api/student/training-tasks/{taskKey}/ai-evaluation/assessment
  • Added Mockito tests for blank answers, immutable snapshots, score write-back, invalid criteria maxima, cached success, retry after failure, processing state, non-student access, and controller delegation/error mapping.

Test-first evidence

  1. Added the Task 3 service/controller tests before the production DTO, service, and controller existed.
  2. Ran the selected Maven tests and observed the expected RED compilation failure because these three production classes were absent.
  3. Implemented the minimum production API/service, then ran the targeted tests until green.

Verification

mvn -Dtest=AiTrainingEvaluationServiceImplTest,DashScopeQwenChatClientTest,AiTrainingEvaluationControllerTest,StudentTrainingAnswerServiceImplTest test
Tests run: 23, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS

mvn -DskipTests compile
BUILD SUCCESS

Concerns

  • The supplied valid 86-point fixture has criterion earned scores of 34/30/22 (total 86). Validation therefore requires criterion maxima to total 100 and criterion earned scores to equal the top-level score; requiring earned criteria to total 100 would reject that specified fixture.
  • Maven continues to emit pre-existing warnings for project-local Aspose system dependencies and the relocated MySQL artifact.