Accept Merge Request #121: (hyc -> master)

Merge Request: 【修改】mysql关键字0判断

Created By: @华允传
Accepted By: @华允传
URL: https://g-iswv8783.coding.net/p/education/d/pengchen-exam-java/git/merge/121?initial=true
This commit is contained in:
华允传
2025-06-12 22:23:52 +08:00
committed by Coding

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;