test(aihr): enforce pilot completion gate

This commit is contained in:
2026-07-10 00:26:21 +08:00
parent b26c2258cf
commit beaf4f30d0
3 changed files with 15 additions and 5 deletions
@@ -536,6 +536,8 @@ public class AihrPracticeSeedService {
ensureCalibrationTable();
int trainingCount = count("SELECT COUNT(*) FROM aihr_practice_session WHERE tenant_id = ? AND mode = 'mobile'", TENANT_ID);
int pendingAssignments = count("SELECT COUNT(*) FROM aihr_practice_assignment WHERE tenant_id = ? AND status = '待训练'", TENANT_ID);
int assignmentTotal = trainingCount + pendingAssignments;
boolean completionReady = assignmentTotal > 0 && trainingCount * 100 >= assignmentTotal * 80;
int reviewed = count("SELECT COUNT(*) FROM aihr_practice_session WHERE tenant_id = ? AND mode = 'mobile' AND status = '已复盘'", TENANT_ID);
CalibrationStats calibrationStats = calibrationStats();
AihrSopSeedService.SopReviewStats sopStats = sopSeedService.sopReviewStats();
@@ -552,7 +554,9 @@ public class AihrPracticeSeedService {
StringBuilder csv = new StringBuilder();
appendCsvRow(csv, "metric", "value");
appendCsvRow(csv, "training_count", trainingCount);
appendCsvRow(csv, "completion_rate", percent(trainingCount, trainingCount + pendingAssignments));
appendCsvRow(csv, "completion_rate", percent(trainingCount, assignmentTotal));
appendCsvRow(csv, "completion_rate_target", "80.0%");
appendCsvRow(csv, "completion_rate_ready", completionReady);
appendCsvRow(csv, "average_score", String.format(java.util.Locale.ROOT, "%.1f", averageScore == null ? 0 : averageScore));
appendCsvRow(csv, "alert_count", alertCount);
appendCsvRow(csv, "review_rate", percent(reviewed, trainingCount));
@@ -566,7 +570,8 @@ public class AihrPracticeSeedService {
appendCsvRow(csv, "sop_answer_usable_rate", percent(sopStats.usable(), sopStats.total()));
appendCsvRow(csv, "sop_answer_usable_target", "80.0%");
appendCsvRow(csv, "sop_answer_usable_ready", sopStats.total() > 0 && sopStats.usable() * 100 >= sopStats.total() * 80);
appendCsvRow(csv, "pilot_metric_ready", calibrationStats.total() >= 20
appendCsvRow(csv, "pilot_metric_ready", completionReady
&& calibrationStats.total() >= 20
&& calibrationStats.matched() * 100 >= calibrationStats.total() * 70
&& sopStats.total() > 0
&& sopStats.usable() * 100 >= sopStats.total() * 80);