修改理论考试计算平均分

master
xiaoCJ 3 months ago
parent d4fa6d15d8
commit 54e47bd6ca

@ -175,16 +175,14 @@ public class TheoryTestServiceImpl implements TheoryTestService {
List<StuTheoryExamWithBLOBs> stuTheoryExamWithBLOBs = theoryExamMapper.selectByExampleWithBLOBs(example);
BigDecimal totalScore = stuTheoryExamWithBLOBs.stream()
.map(StuTheoryExamWithBLOBs::getScore)
.reduce(BigDecimal.ZERO, BigDecimal::add)
.add(score);
BigDecimal avgScore = totalScore.divide(BigDecimal.valueOf(stuTheoryExamWithBLOBs.size()+1), 2, RoundingMode.HALF_UP);
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal avgScore = totalScore.divide(BigDecimal.valueOf(stuTheoryExamWithBLOBs.size()), 2, RoundingMode.HALF_UP);
record.setAverageScore(avgScore);
}
}
theoryRecordMapper.updateByPrimaryKey(record);
}
@Override
public Date getStartTime(String userId, String source) {
StuTheoryExamExample example = new StuTheoryExamExample();
@ -528,15 +526,6 @@ public class TheoryTestServiceImpl implements TheoryTestService {
}
}
public static void main(String[] args) {
String singleStuAnswer = ", , , ," + " ,";
System.out.println(singleStuAnswer);
String[] split = singleStuAnswer.split(", ");
for (String s : split) {
System.out.println(s);
}
}
@Override
public List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size) throws IOException {
ArrayList<String> idsList = new ArrayList<>();

Loading…
Cancel
Save