fix(judge): 修正分级升级与降级边界逻辑
- 升级时确保等级至少为8级 - 降级时确保等级不低于1级 - 修正多处比较操作,避免越界导致异常 - 优化提示信息中的等级显示,保证一致性 - 增强系统分级判定的鲁棒性
This commit is contained in:
@@ -254,9 +254,9 @@ public class ExamWordsJudgeServiceImpl implements ExamWordsJudgeService {
|
|||||||
boolean canUpgrade = zoneB.getAccuracy() >= 0.8 && (zoneA.getTotalCount() == 0 || zoneA.getAccuracy() >= 0.6);
|
boolean canUpgrade = zoneB.getAccuracy() >= 0.8 && (zoneA.getTotalCount() == 0 || zoneA.getAccuracy() >= 0.6);
|
||||||
if (canUpgrade) {
|
if (canUpgrade) {
|
||||||
return new DiagnosisResult(
|
return new DiagnosisResult(
|
||||||
anchorGrade + 1,
|
Math.max(anchorGrade + 1, ExamWordsConstant.GRADE_8),
|
||||||
ActionType.UPGRADE,
|
ActionType.UPGRADE,
|
||||||
"恭喜!您对" + ExamWordsConstant.getGradeName(anchorGrade) + " 的掌握非常扎实,且具备挑战" + ExamWordsConstant.getGradeName(anchorGrade + 1) + " 的潜力。系统将为您解锁更高阶词库。"
|
"恭喜!您对" + ExamWordsConstant.getGradeName(anchorGrade) + " 的掌握非常扎实,且具备挑战" + ExamWordsConstant.getGradeName(Math.max(anchorGrade + 1, ExamWordsConstant.GRADE_8)) + " 的潜力。系统将为您解锁更高阶词库。"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ public class ExamWordsJudgeServiceImpl implements ExamWordsJudgeService {
|
|||||||
} else if (zoneC.getAccuracy() >= 0.6) {
|
} else if (zoneC.getAccuracy() >= 0.6) {
|
||||||
// Zone C 勉强及格,Zone B 不及格 -> 降一级
|
// Zone C 勉强及格,Zone B 不及格 -> 降一级
|
||||||
return new DiagnosisResult(
|
return new DiagnosisResult(
|
||||||
anchorGrade - 1,
|
Math.max(anchorGrade - 1, ExamWordsConstant.GRADE_1),
|
||||||
ActionType.DOWNGRADE,
|
ActionType.DOWNGRADE,
|
||||||
"检测到" + ExamWordsConstant.getGradeName(anchorGrade) + " 学习吃力,且" + ExamWordsConstant.getGradeName(zoneC.getGradeId()) + " 存在模糊点。建议降级回溯,巩固 " + ExamWordsConstant.getGradeName(zoneC.getGradeId()) + "。"
|
"检测到" + ExamWordsConstant.getGradeName(anchorGrade) + " 学习吃力,且" + ExamWordsConstant.getGradeName(zoneC.getGradeId()) + " 存在模糊点。建议降级回溯,巩固 " + ExamWordsConstant.getGradeName(zoneC.getGradeId()) + "。"
|
||||||
);
|
);
|
||||||
@@ -286,14 +286,14 @@ public class ExamWordsJudgeServiceImpl implements ExamWordsJudgeService {
|
|||||||
// 检查 Zone D
|
// 检查 Zone D
|
||||||
if (zoneD.getTotalCount() > 0 && zoneD.getAccuracy() >= 0.6) {
|
if (zoneD.getTotalCount() > 0 && zoneD.getAccuracy() >= 0.6) {
|
||||||
return new DiagnosisResult(
|
return new DiagnosisResult(
|
||||||
anchorGrade - 2,
|
Math.max(anchorGrade - 2, ExamWordsConstant.GRADE_1),
|
||||||
ActionType.DOWNGRADE,
|
ActionType.DOWNGRADE,
|
||||||
"您的" + ExamWordsConstant.getGradeName(zoneC.getGradeId()) + " 和 " + ExamWordsConstant.getGradeName(anchorGrade) + " 均存在脱节。建议从 " + ExamWordsConstant.getGradeName(zoneD.getGradeId()) + " 开始系统补漏。"
|
"您的" + ExamWordsConstant.getGradeName(zoneC.getGradeId()) + " 和 " + ExamWordsConstant.getGradeName(anchorGrade) + " 均存在脱节。建议从 " + ExamWordsConstant.getGradeName(zoneD.getGradeId()) + " 开始系统补漏。"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 彻底崩盘,可能需要熔断,或者定级到更低
|
// 彻底崩盘,可能需要熔断,或者定级到更低
|
||||||
return new DiagnosisResult(
|
return new DiagnosisResult(
|
||||||
Math.max(1, anchorGrade - 3),
|
Math.max(ExamWordsConstant.GRADE_1, anchorGrade - 3),
|
||||||
ActionType.DOWNGRADE,
|
ActionType.DOWNGRADE,
|
||||||
"基础薄弱,建议暂停当前进度,从低年级核心高频词重新开始。"
|
"基础薄弱,建议暂停当前进度,从低年级核心高频词重新开始。"
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user