|
@@ -48,11 +48,14 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
List<StudentAys> students = new List<StudentAys>();
|
|
List<StudentAys> students = new List<StudentAys>();
|
|
List<ClassAys> classes = new List<ClassAys>();
|
|
List<ClassAys> classes = new List<ClassAys>();
|
|
List<GradeAys> grades = new List<GradeAys>();
|
|
List<GradeAys> grades = new List<GradeAys>();
|
|
|
|
+ List<Dictionary<string, dynamic>> PointAnalysis = new List<Dictionary<string, dynamic>>();
|
|
|
|
+ List<Dictionary<string, dynamic>> exerciseScatter = new List<Dictionary<string, dynamic>>();
|
|
|
|
+ ExamInfo info = null;
|
|
try
|
|
try
|
|
{
|
|
{
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
//获取本次评测所有科目结算结果
|
|
//获取本次评测所有科目结算结果
|
|
- ExamInfo info = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"Exam-{code}"));
|
|
|
|
|
|
+ info = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"Exam-{code}"));
|
|
School school = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<School>(code.ToString(), new PartitionKey($"Base"));
|
|
School school = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<School>(code.ToString(), new PartitionKey($"Base"));
|
|
List<ExamResult> examResults = new List<ExamResult>();
|
|
List<ExamResult> examResults = new List<ExamResult>();
|
|
var query = $"select c.id,c.name,c.subjectId,c.studentScores,c.studentIds,c.paper,c.classes from c where c.examId = '{id}' ";
|
|
var query = $"select c.id,c.name,c.subjectId,c.studentScores,c.studentIds,c.paper,c.classes from c where c.examId = '{id}' ";
|
|
@@ -149,7 +152,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
var stuCount = classRes.range[1] - classRes.range[0] + 1;
|
|
var stuCount = classRes.range[1] - classRes.range[0] + 1;
|
|
var classStudents = students.GetRange(classRes.range[0], classRes.range[1] - classRes.range[0] + 1);
|
|
var classStudents = students.GetRange(classRes.range[0], classRes.range[1] - classRes.range[0] + 1);
|
|
List<double> stuTotals = classStudents.Select(x=>x.total).ToList();
|
|
List<double> stuTotals = classStudents.Select(x=>x.total).ToList();
|
|
- stuTotals.Sort(delegate (double s1, double s2) { return s2.CompareTo(s1); });
|
|
|
|
|
|
+ stuTotals.Sort( ( s1, s2) =>{ return s2.CompareTo(s1); });
|
|
double ipoint = stuTotals[personCount];
|
|
double ipoint = stuTotals[personCount];
|
|
//初始化进线人数
|
|
//初始化进线人数
|
|
int lineCount = 0;
|
|
int lineCount = 0;
|
|
@@ -167,7 +170,10 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
studentIds.Add(x.id);
|
|
studentIds.Add(x.id);
|
|
x.classId = classId;
|
|
x.classId = classId;
|
|
x.className = classroom.name;
|
|
x.className = classroom.name;
|
|
- x.name = classroom.students.Where(s => x.id == x.id).First().name;
|
|
|
|
|
|
+ x.gradeId = classroom.gradeId;
|
|
|
|
+ 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);
|
|
powSum += Math.Pow(x.total - totalAverage, 2);
|
|
//进线人数
|
|
//进线人数
|
|
@@ -178,13 +184,15 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
int index = stuTotals.IndexOf(x.total);
|
|
int index = stuTotals.IndexOf(x.total);
|
|
double CPR = 100 - (100 * (index + 1) - 50) / stuCount;
|
|
double CPR = 100 - (100 * (index + 1) - 50) / stuCount;
|
|
x.cpr = CPR;
|
|
x.cpr = CPR;
|
|
|
|
+ x.csort = index + 1;
|
|
//班级单科的pr
|
|
//班级单科的pr
|
|
x.subjects.ForEach(y=> {
|
|
x.subjects.ForEach(y=> {
|
|
- var subjectT= subjectTotal[y.id];
|
|
|
|
- subjectT.Sort(delegate (double s1, double s2) { return s2.CompareTo(s1); });
|
|
|
|
|
|
+ var subjectT= classStudents.SelectMany(s=>s.subjects).Where(sub=>sub.id==y.id).Select(scr=>scr.score).ToList();
|
|
|
|
+ subjectT.Sort( ( s1, s2) =>{ return s2.CompareTo(s1); });
|
|
int index = subjectT.IndexOf(y.score);
|
|
int index = subjectT.IndexOf(y.score);
|
|
double CPR = 100 - (100 * (index + 1) - 50) / stuCount;
|
|
double CPR = 100 - (100 * (index + 1) - 50) / stuCount;
|
|
y.cpr = CPR;
|
|
y.cpr = CPR;
|
|
|
|
+ y.csort = index + 1;
|
|
//按科目获取一个班的分数
|
|
//按科目获取一个班的分数
|
|
keyValues.Add(new KeyValuePair<string, double>(y.id, y.score));
|
|
keyValues.Add(new KeyValuePair<string, double>(y.id, y.score));
|
|
});
|
|
});
|
|
@@ -251,12 +259,512 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
gradeAys.subjects.Add(subject);
|
|
gradeAys.subjects.Add(subject);
|
|
}
|
|
}
|
|
grades.Add(gradeAys);
|
|
grades.Add(gradeAys);
|
|
|
|
+ //处理学生年级相关的pr值
|
|
|
|
+ var studentAys = students.Where(x => x.gradeId.Equals(greade)).ToList();
|
|
|
|
+ var stuGradeTotal = studentAys.Select(x => x.total).ToList();
|
|
|
|
+ stuGradeTotal.Sort((s1, s2) => { return s2.CompareTo(s1); });
|
|
|
|
+ var stuCount = stuGradeTotal.Count;
|
|
|
|
+ studentAys.ForEach(x => {
|
|
|
|
+ //年级全科的pr
|
|
|
|
+ int index = stuGradeTotal.IndexOf(x.total);
|
|
|
|
+ double GPR = 100 - (100 * (index + 1) - 50) / stuCount;
|
|
|
|
+ x.gpr = GPR;
|
|
|
|
+ x.gsort = index + 1;
|
|
|
|
+ //年级单科的pr
|
|
|
|
+ x.subjects.ForEach(y => {
|
|
|
|
+ var subjectT = studentAys.SelectMany(s => s.subjects).Where(sub => sub.id == y.id).Select(scr => scr.score).ToList(); ;
|
|
|
|
+ subjectT.Sort((s1, s2) => { return s2.CompareTo(s1); });
|
|
|
|
+ int index = subjectT.IndexOf(y.score);
|
|
|
|
+ double GPR = 100 - (100 * (index + 1) - 50) / stuCount;
|
|
|
|
+ y.gpr = GPR;
|
|
|
|
+ y.gsort = index + 1;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
+ PointAnalysis = getPointAnalysises(examResults, info);
|
|
|
|
+ exerciseScatter = getExerciseScatteres(examResults, info);
|
|
|
|
+
|
|
}
|
|
}
|
|
catch (Exception ex) {
|
|
catch (Exception ex) {
|
|
|
|
|
|
}
|
|
}
|
|
- return Ok(new { students, classes, grades });
|
|
|
|
|
|
+ var sub = info.subjects.Select(x => new { id = x.id, name = x.name });
|
|
|
|
+ return Ok(new { students, classes, grades , points= PointAnalysis,paper= exerciseScatter, subjects=sub });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private static List<Dictionary<string, dynamic>> getExerciseScatteres(List<ExamResult> exams, ExamInfo exam)
|
|
|
|
+ {
|
|
|
|
+ /* ResponseBuilder builder = ResponseBuilder.custom();*/
|
|
|
|
+ List<string> classList = new List<string>();
|
|
|
|
+ List<Dictionary<string, object>> exerciseScatter = new List<Dictionary<string, object>>();
|
|
|
|
+ //Dictionary<string, object> scatterAnalysis = new Dictionary<string, object>();
|
|
|
|
+ classList = exam.targetClassIds;
|
|
|
|
+ List<string> key = new List<string>
|
|
|
|
+ {
|
|
|
|
+ "id",
|
|
|
|
+ "type",
|
|
|
|
+ "areaName",
|
|
|
|
+ "score",
|
|
|
|
+ "diff",
|
|
|
|
+ "identify",
|
|
|
|
+ "classScoreRate",
|
|
|
|
+ "gradeScoreRate",
|
|
|
|
+ "areaScoreRate",
|
|
|
|
+ "highScoreRate",
|
|
|
|
+ "lowScoreRate",
|
|
|
|
+ "knowledgePoint",
|
|
|
|
+ "R1",
|
|
|
|
+ "R2",
|
|
|
|
+ "R3",
|
|
|
|
+ "R4",
|
|
|
|
+ "R5",
|
|
|
|
+ "R6",
|
|
|
|
+ "PH",
|
|
|
|
+ "PL",
|
|
|
|
+ "X",
|
|
|
|
+ "Y",
|
|
|
|
+ "knowledge"
|
|
|
|
+ };
|
|
|
|
+ if (exams.IsNotEmpty())
|
|
|
|
+ {
|
|
|
|
+ exams.ForEach(e =>
|
|
|
|
+ {
|
|
|
|
+ List<double> gradeAnswer = new List<double>();
|
|
|
|
+ List<string> grasdepersent = new List<string>();
|
|
|
|
+ for (int n = 0; n < e.paper.point.Count; n++)
|
|
|
|
+ {
|
|
|
|
+ gradeAnswer.Add(0);
|
|
|
|
+ }
|
|
|
|
+ //参考人数
|
|
|
|
+ double Qnum = 0;
|
|
|
|
+ e.studentIds.ForEach(i =>
|
|
|
|
+ {
|
|
|
|
+ if (!i.Equals("0"))
|
|
|
|
+ {
|
|
|
|
+ Qnum++;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ /* Dictionary<string, object> detail = new Dictionary<string, object>
|
|
|
|
+ {
|
|
|
|
+ { "keys", key }
|
|
|
|
+ };*/
|
|
|
|
+ List<List<string>> datas = new List<List<string>>();
|
|
|
|
+ List<string[]> itemAnalysis = new List<string[]>();
|
|
|
|
+ Dictionary<string, object> subject = new Dictionary<string, object>
|
|
|
|
+ {
|
|
|
|
+ { "name", e.subjectId }
|
|
|
|
+ };
|
|
|
|
+ Dictionary<string, object> classPersent = new Dictionary<string, object>();
|
|
|
|
+ List<List<string>> classdatas = new List<List<string>>();
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ e.classes.ForEach(c =>
|
|
|
|
+ {
|
|
|
|
+ //初始化每题得分情况
|
|
|
|
+ List<int> answerCount = new List<int>();
|
|
|
|
+ List<string> persent = new List<string>();
|
|
|
|
+ double peopleCount = 0;
|
|
|
|
+ for (int n = 0; n < e.paper.point.Count; n++)
|
|
|
|
+ {
|
|
|
|
+ answerCount.Add(0);
|
|
|
|
+ }
|
|
|
|
+ int qCount = 0;
|
|
|
|
+ //int right = 0;
|
|
|
|
+ /* //c.Keys遍历key值
|
|
|
|
+ foreach (string keys in c.Keys)
|
|
|
|
+ {
|
|
|
|
+ classList.Add(keys);
|
|
|
|
+ }*/
|
|
|
|
+ //每个班级得分占比
|
|
|
|
+
|
|
|
|
+ for (int i = c.range[0]; i <= c.range[1]; i++)
|
|
|
|
+ {
|
|
|
|
+ if (e.studentScores[i].Sum() > 0)
|
|
|
|
+ {
|
|
|
|
+ for (int j = 0; j < e.studentScores[i].Count; j++)
|
|
|
|
+ {
|
|
|
|
+ if (e.studentScores[i][j] > 0)
|
|
|
|
+ {
|
|
|
|
+ //记录班级每题得分数
|
|
|
|
+ answerCount[j] = answerCount[j] + 1;
|
|
|
|
+ //记录年级每题得分数
|
|
|
|
+ gradeAnswer[j] = gradeAnswer[j] + 1;
|
|
|
|
+
|
|
|
|
+ //right++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ qCount++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ peopleCount = c.range[1] - c.range[0] + 1 - qCount;
|
|
|
|
+ }
|
|
|
|
+ foreach (int p in answerCount)
|
|
|
|
+ {
|
|
|
|
+ var t = Math.Floor(Math.Round(decimal.Parse((p / peopleCount).ToString("0.000")), 2) * 100);
|
|
|
|
+ persent.Add(t.ToString());
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ classdatas.Add(persent);
|
|
|
|
+ });
|
|
|
|
+ classPersent.Add("classList", classList);
|
|
|
|
+ classPersent.Add("datas", classdatas);
|
|
|
|
+ exerciseScatter.Add(classPersent);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ double[] point = StringHelper.ListTodouble(e.paper.point);
|
|
|
|
+ double[,] result = StringHelper.ListToDouble(e.studentScores);
|
|
|
|
+ var cdm = new ClouDASMatrix(result, point);
|
|
|
|
+ //试题Y
|
|
|
|
+ List<double> answer = cdm.AnswerRate;
|
|
|
|
+ //试题X
|
|
|
|
+ List<double> quality = cdm.QualityRate;
|
|
|
|
+ //试题区域
|
|
|
|
+ List<string> topic = cdm.TopicFallArea;
|
|
|
|
+ //试题相关分析结果
|
|
|
|
+ List<(double Diff, double Identify, double R1, double R2, double R3, double R4, double R5, double R6, double RH, double RL)> rs = cdm.RS;
|
|
|
|
+ for (int i = 0; i < rs.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ string[] ex = new string[] { };
|
|
|
|
+ string ss = rs[i].ToString()[1..^1];
|
|
|
|
+ ex = ss.Split(",");
|
|
|
|
+ itemAnalysis.Add(ex);
|
|
|
|
+ }
|
|
|
|
+ foreach (int p in gradeAnswer)
|
|
|
|
+ {
|
|
|
|
+ var t = Math.Floor(Math.Round(decimal.Parse((p / Qnum).ToString("0.000")), 2) * 100);
|
|
|
|
+ grasdepersent.Add(t.ToString());
|
|
|
|
+ }
|
|
|
|
+ for (int k = 0; k < e.paper.point.Count; k++)
|
|
|
|
+ {
|
|
|
|
+ List<string> values = new List<string>();
|
|
|
|
+ key.ForEach(x =>
|
|
|
|
+ {
|
|
|
|
+ values.Add("-");
|
|
|
|
+ });
|
|
|
|
+ values[0] = (k + 1).ToString();
|
|
|
|
+ values[1] = "";
|
|
|
|
+ values[2] = topic[k].ToString();
|
|
|
|
+ values[3] = e.paper.point[k].ToString();
|
|
|
|
+ if (itemAnalysis.Count > 0)
|
|
|
|
+ {
|
|
|
|
+ values[4] = itemAnalysis[k][0];
|
|
|
|
+ values[5] = itemAnalysis[k][1];
|
|
|
|
+ values[12] = itemAnalysis[k][2];
|
|
|
|
+ values[13] = itemAnalysis[k][3];
|
|
|
|
+ values[14] = itemAnalysis[k][4];
|
|
|
|
+ values[15] = itemAnalysis[k][5];
|
|
|
|
+ values[16] = itemAnalysis[k][6];
|
|
|
|
+ values[17] = itemAnalysis[k][7];
|
|
|
|
+ values[18] = itemAnalysis[k][8];
|
|
|
|
+ values[19] = itemAnalysis[k][9];
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ values[4] = "-";
|
|
|
|
+ values[5] = "-";
|
|
|
|
+ values[12] = "-";
|
|
|
|
+ values[13] = "-";
|
|
|
|
+ values[14] = "-";
|
|
|
|
+ values[15] = "-";
|
|
|
|
+ values[16] = "-";
|
|
|
|
+ values[17] = "-";
|
|
|
|
+ values[18] = "-";
|
|
|
|
+ values[19] = "-";
|
|
|
|
+ }
|
|
|
|
+ values[7] = grasdepersent[k];
|
|
|
|
+ values[8] = grasdepersent[k];
|
|
|
|
+ values[20] = quality[k].ToString();
|
|
|
|
+ values[21] = answer[k].ToString();
|
|
|
|
+ string pointName = "";
|
|
|
|
+ /*if (paper[0].item[k].points.Count == 1)
|
|
|
|
+ {
|
|
|
|
+ foreach (string index in paper[0].item[k].points)
|
|
|
|
+ {
|
|
|
|
+ pointName = index;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if (paper[0].item[k].points.Count > 1)
|
|
|
|
+ {
|
|
|
|
+ foreach (string index in paper[0].item[k].points)
|
|
|
|
+ {
|
|
|
|
+ pointName += index + ",";
|
|
|
|
+ }
|
|
|
|
+ }*/
|
|
|
|
+ values[22] = pointName;
|
|
|
|
+ datas.Add(values);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ subject.Add("keys", key);
|
|
|
|
+ subject.Add("datas", datas);
|
|
|
|
+ exerciseScatter.Add(subject);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex)
|
|
|
|
+ {
|
|
|
|
+ // throw new BizException(ex.Message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ return exerciseScatter;
|
|
|
|
+ }
|
|
|
|
+ else return exerciseScatter;
|
|
|
|
+ }
|
|
|
|
+ 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)
|
|
|
|
+ {
|
|
|
|
+ List<Dictionary<string, dynamic>> scatterAnalysis = new List<Dictionary<string, dynamic>>();
|
|
|
|
+ List<string> key = new List<string>
|
|
|
|
+ {
|
|
|
|
+ "name",
|
|
|
|
+ "className",
|
|
|
|
+ "x",
|
|
|
|
+ "y",
|
|
|
|
+ "memberId",
|
|
|
|
+ "score",
|
|
|
|
+ "trueNum",
|
|
|
|
+ "falseNum",
|
|
|
|
+ "hardList",
|
|
|
|
+ "carefulList",
|
|
|
|
+ "scatter"
|
|
|
|
+ };
|
|
|
|
+ //key.Add("areaName");
|
|
|
|
+ if (exams.Count > 0)
|
|
|
|
+ {
|
|
|
|
+ /* //提取班级信息
|
|
|
|
+ List<Dictionary<string, int[]>> classToName = exams[0].classes;
|
|
|
|
+ //提取学生ID信息
|
|
|
|
+ List<string> idToName = exams[0].ids;*/
|
|
|
|
+ exams.ForEach(e =>
|
|
|
|
+ {
|
|
|
|
+ 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>
|
|
|
|
+ {
|
|
|
|
+ { "name", 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 + "--------------------------");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ return scatterAnalysis;
|
|
|
|
+ }
|
|
|
|
+ else return scatterAnalysis;
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|