CrazyIter_Bin hace 4 años
padre
commit
c20239a7c2

+ 110 - 2
TEAMModelOS/Controllers/Analysis/AnalysisController.cs

@@ -171,7 +171,9 @@ namespace TEAMModelOS.Controllers.Analysis
                         x.classId = classId;
                         x.className = classroom.name;
                         x.gradeId = classroom.gradeId;
-                        x.name = classroom.students.Where(s => x.id == x.id).First().name;
+                        var stu = classroom.students.Where(s => x.id == x.id).First();
+                        x.name = stu.name;
+                        x.no = stu.no;
                         //标准差
                         powSum += Math.Pow(x.total - totalAverage, 2);
                         //进线人数
@@ -512,10 +514,116 @@ namespace TEAMModelOS.Controllers.Analysis
             }
             else return exerciseScatter;
         }
-        private void DoEx(ExamResult result, ExamInfo exam, List<string> key,string subjectId) 
+        private void DoEx(ExamResult e, ExamInfo exam, List<string> key) 
         {
             Dictionary<string, dynamic> scatterAnalysis = new Dictionary<string, dynamic>();
+            Dictionary<string, object> detail = new Dictionary<string, object>
+                    {
+                        { "keys", key }
+                    };
+            List<List<string>> datas = new List<List<string>>();
+            Dictionary<string, object> subject = new Dictionary<string, object>
+                    {
+                        { "subjectId", e.subjectId }
+                    };
+            double[] point = StringHelper.ListTodouble(e.paper.point);
+            double[,] result = StringHelper.ListToDouble(e.studentScores);
+            try
+            {
+                var cdm = new ClouDASMatrix(result, point);
+                //学生通过率
+                List<double> pass = cdm.PassingRate;
+                //学生稳定度
+                List<double> sta = cdm.StabilityRate;
+                //落点区域
+                List<string> stu = cdm.StuFallArea;
+                //需努力的题型
+                List<int[]> strive = cdm.StriveTopic;
+                //需小心的题型
+                List<int[]> careful = cdm.CarefulTopic;
+                int i = 0;
+                for (int k = e.studentIds.Count - 1; k >= 0; k--)
+                {
+                    if (e.studentIds[k].Equals("0"))
+                    {
+                        e.studentIds.Remove(e.studentIds[k]);
+                    }
+                }
+                e.studentIds.ForEach(s =>
+                {
+                    if (e.studentScores[i].Sum() != 0)
+                    {
+                        List<string> info = new List<string>
+                                {
+                                    s,
+                                    "-",
+                                    sta[i].ToString(),
+                                    pass[i].ToString(),
+                                    i + 1 + "",
+                                    e.studentScores[i].Sum().ToString()
+                                };
+                        int right = 0;
+                        int wrong = 0;
+                        foreach (int p in e.studentScores[i])
+                        {
+                            if (p > 0)
+                            {
+                                right++;
+                            }
+                            else
+                            {
+                                wrong++;
+                            }
+                        }
+                        info.Add(right + "");
+                        info.Add(wrong + "");
+                        int[] str = strive[i];
+                        string striveAll = "";
+
+                        foreach (int n in str)
+                        {
+                            striveAll += n.ToString() + ",";
+                        }
+                        int[] care = careful[i];
+                        string careAll = "";
+                        foreach (int n in care)
+                        {
+                            careAll += n.ToString() + ",";
+                        }
+                        if (string.IsNullOrEmpty(striveAll))
+                        {
+                            info.Add("无");
+                        }
+                        else
+                        {
+                            info.Add(striveAll.Substring(0, striveAll.Length - 1));
+                        }
+                        if (string.IsNullOrEmpty(careAll))
+                        {
+                            info.Add("无");
+                        }
+                        else
+                        {
+                            info.Add(careAll.Substring(0, careAll.Length - 1)); ;
+                        }
+                        info.Add(stu[i].ToString());
+                        datas.Add(info);
 
+                    }
+                    i++;
+                });
+                //AchievementService.ReName(datas, idToName, classToName, students);
+                detail.Add("datas", datas);
+                subject.Add("scatter", detail);
+                //scatterAnalysis.Add(subject);
+
+            }
+            catch (Exception ex)
+            {
+                //builder.Data(exams);
+                //ex.Message;
+                Console.WriteLine("---------------------" + ex.Message + "--------------------------");
+            }
         }
         //落点分析
         private static List<Dictionary<string, dynamic>> getPointAnalysises(List<ExamResult> exams, ExamInfo exam)

+ 1 - 0
TEAMModelOS/Controllers/Analysis/StudentAys.cs

@@ -8,6 +8,7 @@ namespace TEAMModelOS.Controllers.Analysis
     public class StudentAys
     {
         public string id { get; set; }
+        public string no { get; set; }
         public string name { get; set; }
         public double total { get; set; }
         public double gpr { get; set; }