fix(aihr): require explicit calibration scores
This commit is contained in:
+4
-1
@@ -1488,6 +1488,9 @@ public class AihrPracticeSeedService {
|
||||
}
|
||||
|
||||
public CalibrationResponse calibrate(String sessionId, CalibrationRequest request) {
|
||||
if (request == null || request.correctedTotal() == null) {
|
||||
throw new ServiceException("人工校准必须明确填写总分");
|
||||
}
|
||||
ensurePracticeTable();
|
||||
ensureCalibrationTable();
|
||||
if (isBlank(sessionId)) {
|
||||
@@ -1509,7 +1512,7 @@ public class AihrPracticeSeedService {
|
||||
return null;
|
||||
}
|
||||
ScoreSnapshot score = rows.get(0);
|
||||
int correctedTotal = request == null || request.correctedTotal() == null ? score.total() : clampScore(request.correctedTotal());
|
||||
int correctedTotal = clampScore(request.correctedTotal());
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String reviewer = firstNonBlank(request == null ? null : request.reviewer(), "主管复盘");
|
||||
String reason = firstNonBlank(request == null ? null : request.reason(), "人工校准AI评分");
|
||||
|
||||
+9
@@ -110,6 +110,15 @@ public class AihrPracticeSeedServiceTest {
|
||||
assertEquals("缺少员工ID,无法派发专项训练", error.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void calibrationRequiresExplicitCorrectedScore() {
|
||||
AihrPracticeSeedService service = new AihrPracticeSeedService(new ObjectMapper(), null, null, null);
|
||||
|
||||
ServiceException error = assertThrows(ServiceException.class, () -> service.calibrate("session-1", null));
|
||||
|
||||
assertEquals("人工校准必须明确填写总分", error.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scenarioFilterKeepsRealEmptyDatabaseResultEmpty() {
|
||||
JdbcTemplate jdbcTemplate = mock(JdbcTemplate.class);
|
||||
|
||||
Reference in New Issue
Block a user