OnePsycho 4 lat temu
rodzic
commit
7e7b6659bc

+ 14 - 5
TEAMModelOS/Controllers/Analysis/AnalysisController.cs

@@ -92,6 +92,7 @@ namespace TEAMModelOS.Controllers.Analysis
                 "examScoreRate"
             };
             ExamInfo info = null;
+            double ipoint = 0;
             Dictionary<string, dynamic> gpoint = new Dictionary<string, dynamic>();
             List<KeyValuePair<string, List<List<string>>>> subjectPaperDatas = new List<KeyValuePair<string, List<List<string>>>>();
             List<KeyValuePair<string, List<KeyValuePair<string, List<double>>>>> classSubjectPaperDatas = new List<KeyValuePair<string, List<KeyValuePair<string, List<double>>>>>();
@@ -227,7 +228,7 @@ namespace TEAMModelOS.Controllers.Analysis
                 }
                 //处理进线分数
                 gradeTotal.Sort((s1, s2) => { return s2.CompareTo(s1); });
-                double ipoint = gradeTotal[personCount];
+                ipoint = gradeTotal[personCount];
                 //以班级为单位
                 foreach (string classId in info.targetClassIds)
                 {
@@ -407,12 +408,12 @@ namespace TEAMModelOS.Controllers.Analysis
             
             }
             var sub = info.subjects.Select(x => new { id = x.id, name = x.name });
-            return Ok(new { students, classes, grades , paper= subjectPaperDatas, subjects=sub, scatterKey = scatterKey,paperKey=paperKey, pointKey = gpoint });
+            return Ok(new { students, classes, grades , paper= subjectPaperDatas, subjects=sub, scatterKey = scatterKey,paperKey=paperKey, pointKey = gpoint, ipoint = ipoint });
         }
 
         private static (KeyValuePair<string,List<List<string>>>, KeyValuePair<string, List<KeyValuePair<string, List<double>>>>,   Dictionary<string, List<double>>) DoExerciseScatteres(ExamResult e,  List<string > paperKey) 
         {
-            List<double> examAnswer = new List<double>();
+            List<int> examAnswer = new List<int>();
             List<string> examPersent = new List<string>();
             for (int n = 0; n < e.paper.point.Count; n++)
             {
@@ -475,8 +476,16 @@ namespace TEAMModelOS.Controllers.Analysis
                     classdatas.Add(new KeyValuePair<string, List<double>>(c.id, persent));
                     if (gradeItemScore.ContainsKey(c.gradeId))
                     {
-                        int index = 0;
-                        gradeItemScore[c.gradeId].ForEach(x => { x = x + answerCount[index]; index += 1; });
+                        
+                        var we = gradeItemScore[c.gradeId];
+                        
+                        List<int> count = we;
+                        for (int index =0;index<count.Count;index++) {
+                            count[index] = count[index] + answerCount[index];
+                             
+                        }
+                        gradeItemScore[c.gradeId] = count;
+                       // gradeItemScore[c.gradeId].ForEach(x => { x = x + answerCount[index]; index += 1; });
                         gradeItemStuCount[c.gradeId]= gradeItemStuCount[c.gradeId] + peopleCount;
                     }
                     else {