Explorar el Código

fix: 修改题目难度系数

181250114 hace 4 años
padre
commit
444eb42b52

+ 2 - 2
src/main/java/com/seecoder/dataanalysis/analysis/EvalDataAnalysisService.java

@@ -12,7 +12,7 @@ import java.util.Map;
 public interface EvalDataAnalysisService {
 
     /**
-     * 根据学生id,分析该学生的能力树,返回可视化结果
+     * 根据学生id,分析该学生的能力树,返回可用于可视化结果
      * @param student_id 学生id
      * @return competency_tree 返回能力树
      */
@@ -26,7 +26,7 @@ public interface EvalDataAnalysisService {
     CompetencyTree getTreeAfterExam(int exam_id);
 
     /**
-     * 获得学生的错题列表
+     * 根据学生id,获得学生的错题列表
      * @param student_id 学生id
      * @return Map<String, Double> errorQuestions 返回学生的错误题目
      */

+ 16 - 7
src/main/java/com/seecoder/dataanalysis/analysis/impl/EvalDataAnalysisServiceImpl.java

@@ -12,6 +12,7 @@ import com.seecoder.dataanalysis.data.entity.competency.KSScore;
 import com.seecoder.dataanalysis.data.entity.eval.EvalExamInfo;
 import com.seecoder.dataanalysis.data.entity.eval.EvalExamRecord;
 import com.seecoder.dataanalysis.data.entity.eval.Question;
+import com.sun.xml.internal.bind.v2.TODO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -36,12 +37,15 @@ public class EvalDataAnalysisServiceImpl implements EvalDataAnalysisService {
 
     @Override
     public CompetencyTree getTreeById(int student_id){
+        //TODO 和ModelTree进行合并,空值补0,返回可以用于可视化的结果
         return null;
     }
 
     @Override
     public CompetencyTree getTreeAfterExam(int exam_id){
         //TODO 测试检查
+        //TODO 修改Question的对应关系
+        //TODO 修改成逐条添加的形式
         EvalExamRecord evalExamRecord = evalExamRecordDao.findById(exam_id).get();
         EvalExamInfo evalExamInfo = evalExamInfoDao.findById(exam_id).get();
         CompetencyTree competencyTree = competencyTreeDao.findByStudentId(evalExamRecord.getStudentId());
@@ -51,21 +55,22 @@ public class EvalDataAnalysisServiceImpl implements EvalDataAnalysisService {
         Integer difficulty = evalExamInfo.getDifficulty();
         String disposition = evalExamInfo.getDisposition();
         Double tree_Score = competencyTree.getTreeScore();
+        double[] difficulty_percent = new double[]{1.0,1.25,1.5,1.75,2.0};
         //得到学生所有题目的得分
         Map<String, Double> studentScores = evalExamRecord.getErrorQuestions();
-        Map<String,Double> questionAndScore = evalExamInfo.getQuestionAndScore();
+//        Map<String,Double> questionAndScore = evalExamInfo.getQuestionAndScore();
         for(Map.Entry<String, Double> entry : studentScores.entrySet()){
             String questionId = entry.getKey();
             Question question = questionDao.findById(questionId).get();
             //在能力树中加成的部分 = 学生得分 * 试卷难度
-            Double percent = difficulty * studentScores.get(questionId);
-            tree_Score += percent;
+            Double addScore = difficulty_percent[difficulty] * studentScores.get(questionId);
+            tree_Score += addScore;
             //根据competency找大分类
             for(KSDScore ksdScore : subTree){
                 if(ksdScore.getCompetency().equals(question.getCompetency())){
                     //增加该能力子树的分数
                     Double total_score = ksdScore.getTotalScore();
-                    total_score += percent;
+                    total_score += addScore;
                     ksdScore.setTotalScore(total_score);
                     //在对应的competency下进行下一步小分类
                     //修改K-S的分数
@@ -74,7 +79,7 @@ public class EvalDataAnalysisServiceImpl implements EvalDataAnalysisService {
                         if(ksScore.getKnowledge() == question.getKsScore().getKnowledge()){
                             List<Double> Skills = ksScore.getSkillsAndScore();
                             for(int i=0;i<Skills.size();i++){
-                                Double score = question.getKsScore().getSkillsAndScore().get(i) * percent + Skills.get(i);
+                                Double score = question.getKsScore().getSkillsAndScore().get(i) * addScore + Skills.get(i);
                                 Skills.set(i,score);
                             }
                             ksScore.setSkillsAndScore(Skills);
@@ -85,7 +90,7 @@ public class EvalDataAnalysisServiceImpl implements EvalDataAnalysisService {
                     //修改Disposition的分数
                     for(DScore dScore : subD){
                         if(dScore.getName().equals(disposition)){
-                            Double score = percent + dScore.getScore();
+                            Double score = addScore + dScore.getScore();
                             dScore.setScore(score);
                             break;
                         }
@@ -101,5 +106,9 @@ public class EvalDataAnalysisServiceImpl implements EvalDataAnalysisService {
     }
 
     @Override
-    public Map<String, Double> getStudentErrorQuestions(int student_id){return null;}
+    public Map<String, Double> getStudentErrorQuestions(int student_id){
+        //TODO 需要综合题目总分考虑
+
+        return null;
+    }
 }