瀏覽代碼

Merge branch 'develop3.0-tmd' of http://106.12.23.251:10080/TEAMMODEL/TEAMModelOS into develop3.0-tmd

OnePsycho 4 年之前
父節點
當前提交
1dc3390cb0
共有 1 個文件被更改,包括 17 次插入10 次删除
  1. 17 10
      TEAMModelOS/Controllers/Analysis/AnalysisController.cs

+ 17 - 10
TEAMModelOS/Controllers/Analysis/AnalysisController.cs

@@ -92,11 +92,13 @@ namespace TEAMModelOS.Controllers.Analysis
                 "examScoreRate"
             };
             ExamInfo info = null;
-            double ipoint = 0;
-            Dictionary<string, dynamic> gpoint = new Dictionary<string, dynamic>();
-            Dictionary<string, dynamic> glevel = new Dictionary<string, dynamic>();
+            double ipoint = 0;          
             List<KeyValuePair<string, List<List<string>>>> subjectPaperDatas = new List<KeyValuePair<string, List<List<string>>>>();
+            List<Dictionary<string, object>> valuePairs = new List<Dictionary<string, object>>();            
             List<KeyValuePair<string, List<KeyValuePair<string, List<double>>>>> classSubjectPaperDatas = new List<KeyValuePair<string, List<KeyValuePair<string, List<double>>>>>();
+            //获取进线标准以及踩线分数
+            int touch = 0;
+            int income = 0;
             try
             {
                 var client = _azureCosmos.GetCosmosClient();
@@ -117,13 +119,13 @@ namespace TEAMModelOS.Controllers.Analysis
                     examClassResults.Add(item);
 
                 }
-                //获取进线标准
-                int touch = 0;
+
                 foreach (Period period in school.period)
                 {
                     if (info.period.id.Equals(period.id))
                     {
                         touch = period.analysis.touch;
+                        income = period.analysis.income;
                     }
                 }
                 //计算每个年级参考人数并计算进线分数
@@ -161,7 +163,7 @@ namespace TEAMModelOS.Controllers.Analysis
                     keys.Add(new KeyValuePair<string, double>(grade.id, ipoint));
                 }*/
                 //获取进线人数
-                int personCount = (int)System.Math.Round(info.stuCount * (touch / 100.0), MidpointRounding.AwayFromZero);
+                int personCount = (int)System.Math.Round(info.stuCount * (income / 100.0), MidpointRounding.AwayFromZero);
 
                 /* //声明年级所有科目总分
                  List<double> total = new List<double>();*/
@@ -175,12 +177,17 @@ namespace TEAMModelOS.Controllers.Analysis
                 foreach (ExamResult examResult in examResults)
                 {
                     (KeyValuePair<string, List<List<string>>> subjectData, KeyValuePair<string, List<KeyValuePair<string, List<double>>>> classSubjectData , Dictionary<string, List<double>> gscore) =DoExerciseScatteres(examResult, paperKey);
-                    gscores.Add(new KeyValuePair<string, Dictionary<string, List<double>>>(examResult.subjectId, gscore));                   
+                    gscores.Add(new KeyValuePair<string, Dictionary<string, List<double>>>(examResult.subjectId, gscore));
+/*                    Dictionary<string, dynamic> gpoint = new Dictionary<string, dynamic>();
+                    Dictionary<string, dynamic> glevel = new Dictionary<string, dynamic>();*/
+                    Dictionary<string, object> gpointList = new Dictionary<string, object>();
                     subjectPaperDatas.Add(subjectData);
                     classSubjectPaperDatas.Add(classSubjectData);
                     subjectScatter.Add(DoSubjectScatter(examResult));
-                    gpoint = DoKnowledgePoint(examResult,info);
-                    glevel = DoLevel(examResult, info);
+                    gpointList.Add("subjectId", examResult.subjectId);
+                    gpointList.Add("pointKey", DoKnowledgePoint(examResult, info));
+                    gpointList.Add("levelKey", DoLevel(examResult, info));
+                    valuePairs.Add(gpointList);
                     //获取一张试卷的满分
                     paperScore.Add(examResult.subjectId, examResult.paper.point.Sum());
                     List<double> StuSubjectTotals = new List<double>();
@@ -410,7 +417,7 @@ 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, ipoint = ipoint,levelKey = glevel });
+            return Ok(new { students, classes, grades , paper= subjectPaperDatas, subjects=sub, scatterKey = scatterKey,paperKey=paperKey, pointLevelKey = valuePairs, ipoint = ipoint,touchScore = touch});
         }
 
         private static (KeyValuePair<string,List<List<string>>>, KeyValuePair<string, List<KeyValuePair<string, List<double>>>>,   Dictionary<string, List<double>>) DoExerciseScatteres(ExamResult e,  List<string > paperKey)