Преглед изворни кода

试评任务增加唯一索引

ting.yin пре 6 година
родитељ
комит
735835b315

+ 2 - 1
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/mark/model/TrialLibrary.java

@@ -8,6 +8,7 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.Id;
 import javax.persistence.Table;
 import javax.persistence.Transient;
+import javax.persistence.UniqueConstraint;
 
 /**
  * 试评任务表
@@ -16,7 +17,7 @@ import javax.persistence.Transient;
  *
  */
 @Entity
-@Table(name = "m_trial_library")
+@Table(name = "m_trial_library",uniqueConstraints={@UniqueConstraint(columnNames={"groupNumber","studentId"})})
 public class TrialLibrary implements Serializable {
 
     private static final long serialVersionUID = 6791719880545458247L;

+ 8 - 8
stmms-web/src/main/java/cn/com/qmth/stmms/admin/thread/ScoreCheckThread.java

@@ -78,7 +78,7 @@ public class ScoreCheckThread implements Runnable {
         checkQuestionScore(findExamQuestion(student.getSubjectCode(), false), student.getScoreList(false));
     }
 
-    private void checkQuestionScore(List<ExamQuestion> questionList, List<ScoreItem> scoreList) {
+	private void checkQuestionScore(List<ExamQuestion> questionList, List<ScoreItem> scoreList) {
         for (int i = 0; i < questionList.size(); i++) {
             ExamQuestion question = questionList.get(i);
 
@@ -88,11 +88,11 @@ public class ScoreCheckThread implements Runnable {
             } catch (Exception e) {
             }
             // 针对每道小题分别统计零分人数与满分人数
-            if (score == 0) {
-                question.setZeroCount(question.getZeroCount() + 1);
-            } else if (score == question.getTotalScore().doubleValue()) {
-                question.setFullCount(question.getFullCount() + 1);
-            }
+//            if (score == 0) {
+//                question.setZeroCount(question.getZeroCount() + 1);
+//            } else if (score == question.getTotalScore().doubleValue()) {
+//                question.setFullCount(question.getFullCount() + 1);
+//            }
             // 统计考生总数
             question.setTotalCount(question.getTotalCount() + 1);
         }
@@ -108,8 +108,8 @@ public class ScoreCheckThread implements Runnable {
             // 从数据库读取后,首先将人数清零
             for (ExamQuestion q : list) {
                 q.setTotalCount(0);
-                q.setZeroCount(0);
-                q.setFullCount(0);
+//                q.setZeroCount(0);
+//                q.setFullCount(0);
             }
             if (isObjective) {
                 objectiveMap.put(subjectCode, list);