Selaa lähdekoodia

组卷分数为空逻辑修改

weiwenhai 7 vuotta sitten
vanhempi
commit
2efa417237

+ 7 - 2
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/GenPaperService.java

@@ -236,8 +236,13 @@ public class GenPaperService {
     			//取到该试卷下所有小题
     			List<PaperDetailUnit> unitList = unitMap.get(paperId);
     			//试卷总分
-    			Double paperScore = unitList.get(0).getPaper().getTotalScore();
-    			if(paperScore.doubleValue() < needScore.doubleValue()){
+    			double sum = 0.0;
+    			if(unitList != null && unitList.size()>0){
+    				for(PaperDetailUnit paperDetailUnit:unitList){
+        				sum = sum + paperDetailUnit.getScore();
+        			}
+    			}
+    			if(sum < needScore.doubleValue()){
     				Paper paper = paperRepo.findOne(paperId);
     				paperMsgMap.put("msg", "\""+paper.getName()+"\"试卷,分数不够");
                     return paperMsgMap;