|
@@ -15,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -112,14 +113,30 @@ public class PaperResultService {
|
|
|
public void globalResult(PaperResult r) {
|
|
|
PaperCommit commit = paperCommitRepo.findByPidAndUid(r.getPid(), r.getUid());
|
|
|
Paper paper = paperService.getOnePaper(r.getPid());
|
|
|
+ //知识点掌握率
|
|
|
r.setKnowledgeRate(88.88);
|
|
|
r.setAbilityScore("{}");
|
|
|
}
|
|
|
|
|
|
- public Double knoledgeRate(PaperCommit commit, Paper paper) {
|
|
|
+ public Double knowledgeRate(PaperResult result,PaperCommit commit, Paper paper) {
|
|
|
+
|
|
|
+ //知识点掌握率 = 各知识点掌握数总和 / 总知识点数
|
|
|
+ //知识点掌握 为 该知识点对应的题目都做对了
|
|
|
Long subjectId = paper.getSubjectId();
|
|
|
String grade = paper.getGrade();
|
|
|
- List<SubjectKnowledge> knowledges = knowledgeService.list(subjectId, grade);
|
|
|
+ List<SubjectKnowledge> knowledge = knowledgeService.list(subjectId, grade);
|
|
|
+ //Map<qid,tag> 定义为一对一
|
|
|
+ Map<Long, String> tags = new LinkedHashMap<>();
|
|
|
+ List<Question> questions = paper.getQuestions();
|
|
|
+ String collectOption = result.getCollectQuestion();
|
|
|
+ String[] options = collectOption.split(",");
|
|
|
+// List<QuestionOption> options = questions.stream().map(Question::getOptions).flatMap(Collection::stream).collect(Collectors.toList());
|
|
|
+ questions.forEach(q -> tags.put(q.getId(), q.getTag()));
|
|
|
+
|
|
|
+ for (SubjectKnowledge k : knowledge) {
|
|
|
+ String abilityCodes = k.getAbilityCodes();
|
|
|
+ String[]codes = abilityCodes.split(",");
|
|
|
+ }
|
|
|
return 0d;
|
|
|
}
|
|
|
|