【修改】mysql关键字0判断

This commit is contained in:
YOHO\20373
2025-06-12 22:22:29 +08:00
parent 469b34eb73
commit afc45bebc8

View File

@@ -859,9 +859,15 @@ public class MysqlServericeImpl implements IMysqlServerice {
.sum();
//乘以 对了多少个 关键字 权值
double finalRoundedScore = new BigDecimal(
((double) totalScoreRate / totalKeyScoreInt) * singleScore
).setScale(2, RoundingMode.HALF_UP).doubleValue();
double finalRoundedScore;
if (totalKeyScoreInt == 0) {
// 如果总键值为0可以设置为0或其他默认值
finalRoundedScore = 0.0;
} else {
finalRoundedScore = new BigDecimal(
((double) totalScoreRate / totalKeyScoreInt) * singleScore
).setScale(2, RoundingMode.HALF_UP).doubleValue();
}
appendToFile(answerLogPath,"❌学生语句"+sql+"不正确,语句权值:"+scoreRateStr+",关键权值:"+totalKeyScoreInt+",答对得分点为:"+matchedKeywords+",答对关键得分权值"+ totalScoreRate+ ",得分" + finalRoundedScore);
return finalRoundedScore;