|
@@ -1,5 +1,6 @@
|
|
package edu.math.diagnosis.service;
|
|
package edu.math.diagnosis.service;
|
|
|
|
|
|
|
|
+import com.google.common.reflect.TypeToken;
|
|
import edu.math.diagnosis.config.Constants;
|
|
import edu.math.diagnosis.config.Constants;
|
|
import edu.math.diagnosis.dao.PaperCommitRepo;
|
|
import edu.math.diagnosis.dao.PaperCommitRepo;
|
|
import edu.math.diagnosis.dao.PaperResultRepo;
|
|
import edu.math.diagnosis.dao.PaperResultRepo;
|
|
@@ -55,7 +56,8 @@ public class PaperResultService {
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|
|
public Result parseResult(PaperCommit paperCommit, Paper paper) {
|
|
public Result parseResult(PaperCommit paperCommit, Paper paper) {
|
|
List<Question> questions = paper.getQuestions();
|
|
List<Question> questions = paper.getQuestions();
|
|
- List<Answer> answers = paperCommit.getAnswers();
|
|
|
|
|
|
+ List<Answer> answers = ObjectUtil.getGson().fromJson(paperCommit.getJsonAns(), new TypeToken<List<Answer>>() {
|
|
|
|
+ }.getType());
|
|
List<Integer> collectQuestion = new ArrayList<>();
|
|
List<Integer> collectQuestion = new ArrayList<>();
|
|
PaperResult result = new PaperResult();
|
|
PaperResult result = new PaperResult();
|
|
result.setPid(paperCommit.getPid());
|
|
result.setPid(paperCommit.getPid());
|
|
@@ -81,7 +83,7 @@ public class PaperResultService {
|
|
if (a == null || StringUtils.isBlank(a.getOptions())) {
|
|
if (a == null || StringUtils.isBlank(a.getOptions())) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- //检测答案的对错
|
|
|
|
|
|
+ //检测答案的对错,此处进行全匹配,全对上该题目才正确
|
|
if (ans.equalsIgnoreCase(a.getOptions())) {
|
|
if (ans.equalsIgnoreCase(a.getOptions())) {
|
|
collectQuestion.add(q.getNumber());
|
|
collectQuestion.add(q.getNumber());
|
|
String jsonScore = q.getJsonScore();
|
|
String jsonScore = q.getJsonScore();
|
|
@@ -94,6 +96,8 @@ public class PaperResultService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //对的选项进行升序排序
|
|
|
|
+ collectQuestion.sort(Integer::compareTo);
|
|
result.setCollectQuestion(StringUtils.join(collectQuestion, ","));
|
|
result.setCollectQuestion(StringUtils.join(collectQuestion, ","));
|
|
result.setJsonScore(ObjectUtil.object2Json(pData));
|
|
result.setJsonScore(ObjectUtil.object2Json(pData));
|
|
//转换分数为百分制
|
|
//转换分数为百分制
|
|
@@ -118,7 +122,7 @@ public class PaperResultService {
|
|
return paperResultRepo.findByPidAndUid(pid, uid);
|
|
return paperResultRepo.findByPidAndUid(pid, uid);
|
|
}
|
|
}
|
|
|
|
|
|
- public boolean delete(Long pid, Long uid) {
|
|
|
|
|
|
+ public int delete(Long pid, Long uid) {
|
|
return paperResultRepo.deleteByPidAndUid(pid, uid);
|
|
return paperResultRepo.deleteByPidAndUid(pid, uid);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -395,8 +399,9 @@ public class PaperResultService {
|
|
return ObjectUtil.object2Json(useTime);
|
|
return ObjectUtil.object2Json(useTime);
|
|
}
|
|
}
|
|
|
|
|
|
- public String avgUseTime(PaperResult paperResult) {
|
|
|
|
- PaperCount count = paperCountService.findByPid(paperResult.getPid());
|
|
|
|
|
|
+ public String avgUseTime(Paper paper) {
|
|
|
|
+ paperCountService.updateAvgCommitTime(paper);
|
|
|
|
+ PaperCount count = paperCountService.findByPid(paper.getId());
|
|
return count.getUseTimeAgvRate();
|
|
return count.getUseTimeAgvRate();
|
|
}
|
|
}
|
|
|
|
|