|
@@ -146,7 +146,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
}
|
|
|
var pow = Math.Round(stus.Count > 0 ? Math.Pow(powSum / stus.Count, 0.5) : 0, 2);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
//获取本次评测所有科目结算结果
|
|
|
List<ExamResult> examResults = new();
|
|
|
ExamInfo info = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<ExamInfo>(examId.ToString(), new PartitionKey($"Exam-{code}"));
|
|
@@ -168,20 +168,21 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
(string subId, List<(string name, List<string> kno)> values) = await getKnowledge("hbcn", client, subjectId.GetString(), "be32942d-97a9-52ba-45d6-2e5b722583f5");
|
|
|
knos = values;
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
(string subId, List<(string name, List<string> kno)> values) = await getKnowledge(info.papers[index].code, client, subjectId.GetString(), info.papers[index].periodId);
|
|
|
knos = values;
|
|
|
- }
|
|
|
+ }
|
|
|
var query = $"select c.id,c.name,c.subjectId,c.studentScores,c.studentIds,c.paper,c.classes,c.sRate,c.average,c.standard,c.lostStus,c.record,c.phc,c.plc from c where c.examId = '{examId}' and c.subjectId = '{subjectId}' ";
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryIterator<ExamResult>(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"ExamResult-{examId}") }))
|
|
|
{
|
|
|
examResults.Add(item);
|
|
|
}
|
|
|
- List<KeyValuePair<string, List<(string name, double score,double aver)>>> pointPersent = new();
|
|
|
- (KeyValuePair<string, List<string>> key1, KeyValuePair<string, List<string>> key2, KeyValuePair<string, List<(string name, double score,double average)>> key3, KeyValuePair<string, List<(string name, double score)>> key4) = DoKnowledgePoint(examResults[0], info);
|
|
|
+ List<KeyValuePair<string, List<(string name, double score, double aver)>>> pointPersent = new();
|
|
|
+ (KeyValuePair<string, List<string>> key1, KeyValuePair<string, List<string>> key2, KeyValuePair<string, List<(string name, double score, double average)>> key3, KeyValuePair<string, List<(string name, double score)>> key4) = DoKnowledgePoint(examResults[0], info);
|
|
|
KeyValuePair<string, List<(string id, double sta, double pass, string stu)>> key = DoSubjectScatter(examResults[0]);
|
|
|
pointPersent.Add(key3);
|
|
|
- List<(string name, double score,double av)> blockScore = new();
|
|
|
+ List<(string name, double score, double av)> blockScore = new();
|
|
|
foreach (var block in knos)
|
|
|
{
|
|
|
double sc = 0;
|
|
@@ -197,26 +198,28 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- blockScore.Add((block.name, sc,av));
|
|
|
+ blockScore.Add((block.name, sc, av));
|
|
|
}
|
|
|
var blk = blockScore.Select(x => new
|
|
|
{
|
|
|
x.name,
|
|
|
x.score,
|
|
|
- persent = Math.Round(x.score > 0 ? x.av / x.score : 0,2),
|
|
|
+ persent = Math.Round(x.score > 0 ? x.av / x.score : 0, 2),
|
|
|
dimension = setting.dimensions.Where(s => s.blocks.Contains(x.name)).Select(x => x.dimension)
|
|
|
});
|
|
|
//获取维度得分率
|
|
|
- var dim = setting.dimensions.Where(q => q.subjectBind.Equals(subjectId.GetString())).Select(x => new {
|
|
|
+ var dim = setting.dimensions.Where(q => q.subjectBind.Equals(subjectId.GetString())).Select(x => new
|
|
|
+ {
|
|
|
x.dimension,
|
|
|
- block = Math.Round( x.blocks.Select(c => new {
|
|
|
- persent = Math.Round(
|
|
|
+ persent = Math.Round(x.blocks.Select(c => new
|
|
|
+ {
|
|
|
+ persent =
|
|
|
blockScore.Where(z => z.name.Equals(c)).Sum(v => v.score) > 0 ?
|
|
|
- blockScore.Where(z => z.name.Equals(c)).Sum(v => v.av) / blockScore.Where(z => z.name.Equals(c)).Sum(v => v.score) : 0,2)
|
|
|
- }).Sum( o=> o.persent) / x.blocks.Count,2)
|
|
|
+ blockScore.Where(z => z.name.Equals(c)).Sum(v => v.av) / blockScore.Where(z => z.name.Equals(c)).Sum(v => v.score) : 0
|
|
|
+ }).Sum(o => o.persent) / x.blocks.Count, 2)
|
|
|
});
|
|
|
|
|
|
- var kno = key4.Value.Select(x => new
|
|
|
+ var kno = key4.Value.Select(x => new
|
|
|
{
|
|
|
x.name,
|
|
|
x.score,
|
|
@@ -250,7 +253,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
double maxc = scores.Max(s => Math.Abs(s));
|
|
|
double minc = scores.Min(s => Math.Abs(s));
|
|
|
double excellentc = scores.Where(s => s >= 80).Count();
|
|
|
- double ex = Math.Round(excellentc / scores.Count,2);
|
|
|
+ double ex = Math.Round(excellentc / scores.Count, 2);
|
|
|
double passc = scores.Where(s => s >= 60).Count();
|
|
|
double pa = Math.Round(passc / scores.Count, 2);
|
|
|
clsInfo.Add((cls.id, classTotal / scores.Count, maxc, minc, ex, pa));
|
|
@@ -268,7 +271,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
examResults[0].classes.Where(c => c.id.Equals(x.cId)).FirstOrDefault().gradeId
|
|
|
});
|
|
|
//年级信息
|
|
|
- var grades = students.GroupBy(c => c.gradeId).Select(x => new { gradeId = x.Key, list = x.ToList().Select(v => v.score).Where(c => c > 0) });
|
|
|
+ var grades = students.GroupBy(c => c.gradeId).Select(x => new { gradeId = x.Key, list = x.ToList().Select(v => v.score).Where(c => c > 0) });
|
|
|
var gscore = grades.Select(x => new
|
|
|
{
|
|
|
id = x.gradeId,
|
|
@@ -276,7 +279,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
score = Math.Round((double)(x.list.Sum() / x.list.Count()), 2),
|
|
|
max = x.list.Max(s => Math.Abs((double)s)),
|
|
|
min = x.list.Min(s => Math.Abs((double)s)),
|
|
|
- excellent = Math.Round( x.list.Where(s => s >= 80).Count() * 1.0 / x.list.Count(),2),
|
|
|
+ excellent = Math.Round(x.list.Where(s => s >= 80).Count() * 1.0 / x.list.Count(), 2),
|
|
|
pass = Math.Round(x.list.Where(s => s >= 60).Count() * 1.0 / x.list.Count(), 2)
|
|
|
});
|
|
|
//获奖次数
|
|
@@ -314,7 +317,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
- return Ok( new { code = 500});
|
|
|
+ return Ok(new { code = 500 });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -369,7 +372,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
}
|
|
|
}
|
|
|
//获取知识点得分率
|
|
|
- private static (KeyValuePair<string, List<string>>, KeyValuePair<string, List<string>>, KeyValuePair<string, List<(string name, double score,double average)>>, KeyValuePair<string, List<(string name, double score)>>) DoKnowledgePoint(ExamResult exam, ExamInfo info)
|
|
|
+ private static (KeyValuePair<string, List<string>>, KeyValuePair<string, List<string>>, KeyValuePair<string, List<(string name, double score, double average)>>, KeyValuePair<string, List<(string name, double score)>>) DoKnowledgePoint(ExamResult exam, ExamInfo info)
|
|
|
{
|
|
|
|
|
|
HashSet<string> knowledge = new HashSet<string>();
|
|
@@ -434,7 +437,9 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
List<double> knowScore = new List<double>();
|
|
|
//学生得分情况
|
|
|
List<double> Score = new List<double>();
|
|
|
- List<(string name, double score,double average)> pointScore = new();
|
|
|
+ List<(string name, double score, double average)> pointScore = new();
|
|
|
+ List<(string name, double score,string cId)> classInfo = new();
|
|
|
+ List<(string name, double score, string sId)> stuInfo = new();
|
|
|
List<(string name, double score)> pointTScore = new();
|
|
|
for (int k = 0; k < knowledgeName.Count; k++)
|
|
|
{
|
|
@@ -442,26 +447,36 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
List<string> itemNo = new List<string>();
|
|
|
int n = 0;
|
|
|
double scores = 0;
|
|
|
-
|
|
|
info.papers[index].knowledge.ForEach(kno =>
|
|
|
{
|
|
|
if (kno.Contains(knowledgeName[k]))
|
|
|
{
|
|
|
var itemPersent = kno.Count > 0 ? 1 / Convert.ToDouble(kno.Count) : 0;
|
|
|
OnePoint += point[n] * itemPersent;
|
|
|
+ //获取知识点每个学生的得分
|
|
|
foreach (string id in exam.studentIds)
|
|
|
{
|
|
|
+ double stuScore = 0;
|
|
|
int index = exam.studentIds.IndexOf(id);
|
|
|
if (exam.studentScores[index][n] > 0)
|
|
|
{
|
|
|
scores += exam.studentScores[index][n] * itemPersent;
|
|
|
+ stuScore = exam.studentScores[index][n] * itemPersent;
|
|
|
}
|
|
|
+ stuInfo.Add((knowledgeName[k], stuScore, id));
|
|
|
+ }
|
|
|
+ foreach (var cla in exam.classes) {
|
|
|
+ double classScores = 0;
|
|
|
+ for (int i = cla.range[0]; i <= cla.range[1]; i++)
|
|
|
+ {
|
|
|
+ classScores += exam.studentScores[i][n] * itemPersent;
|
|
|
+ }
|
|
|
+ classInfo.Add((knowledgeName[k],classScores,cla.id));
|
|
|
}
|
|
|
}
|
|
|
n++;
|
|
|
});
|
|
|
Score.Add(scores);
|
|
|
-
|
|
|
|
|
|
//该知识点平均得分
|
|
|
double sc = exam.studentIds.Count > 0 ? Math.Round(scores * 1.0 / exam.studentIds.Count, 2) : 0;
|
|
@@ -476,12 +491,40 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
//单个知识点所有学生得分率
|
|
|
pointTScore.Add((knowledgeName[k], persent));
|
|
|
//单个知识点的配分
|
|
|
- pointScore.Add((knowledgeName[k], OnePoint,average));
|
|
|
+ pointScore.Add((knowledgeName[k], OnePoint, average));
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ // 获取班级学生知识点得分
|
|
|
+ /* foreach (var cla in exam.classes)
|
|
|
+ {
|
|
|
+ List<(string cId, string kno, double score)> classInfo = new();
|
|
|
+ double classScores = 0;
|
|
|
+ for (int k = 0; k < knowledgeName.Count; k++)
|
|
|
+ {
|
|
|
+ double OnePoint = 0;
|
|
|
+ int n = 0;
|
|
|
+ info.papers[index].knowledge.ForEach(kno =>
|
|
|
+ {
|
|
|
+ if (kno.Contains(knowledgeName[k]))
|
|
|
+ {
|
|
|
+ var itemPersent = kno.Count > 0 ? 1 / Convert.ToDouble(kno.Count) : 0;
|
|
|
+ OnePoint += point[n] * itemPersent;
|
|
|
+ for (int i = cla.range[0]; i < cla.range[1]; i++)
|
|
|
+ {
|
|
|
+ classScores += exam.studentIds[i][n] * itemPersent;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ n++;
|
|
|
+ });
|
|
|
+ classInfo.Add((cla.id, knowledgeName[k], classScores));
|
|
|
+ }
|
|
|
+
|
|
|
+ }*/
|
|
|
+
|
|
|
KeyValuePair<string, List<string>> key1 = new(exam.subjectId, knowledgeName);
|
|
|
KeyValuePair<string, List<string>> key2 = new(exam.subjectId, per);
|
|
|
- KeyValuePair<string, List<(string name, double score,double average)>> key3 = new(exam.subjectId, pointScore);
|
|
|
+ KeyValuePair<string, List<(string name, double score, double average)>> key3 = new(exam.subjectId, pointScore);
|
|
|
KeyValuePair<string, List<(string name, double score)>> key4 = new(exam.subjectId, pointTScore);
|
|
|
//KeyValuePair<string, List<double>> key3 = new KeyValuePair<string, List<double>>(exam.subjectId, allPer);
|
|
|
return (key1, key2, key3, key4);
|