|
@@ -205,11 +205,13 @@ namespace TEAMModelFunction
|
|
|
};
|
|
|
result.info.id = cla;
|
|
|
List<string> ans = new List<string>();
|
|
|
+ List<List<string>> anses = new List<List<string>>();
|
|
|
List<double> ansPoint = new List<double>();
|
|
|
List<string> ids = new List<string>();
|
|
|
foreach (double p in info.papers[m].point)
|
|
|
{
|
|
|
//ans.Add(new List<string>());
|
|
|
+ anses.Add(new List<string>());
|
|
|
ansPoint.Add(-1);
|
|
|
}
|
|
|
var sresponse = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"Class-{info.school}"));
|
|
@@ -282,6 +284,7 @@ namespace TEAMModelFunction
|
|
|
result.studentIds.Add(stu);
|
|
|
result.studentAnswers.Add(ans);
|
|
|
result.studentScores.Add(ansPoint);
|
|
|
+ result.ans.Add(anses);
|
|
|
result.sum.Add(0);
|
|
|
}
|
|
|
|
|
@@ -424,20 +427,10 @@ namespace TEAMModelFunction
|
|
|
}
|
|
|
}
|
|
|
//处理全部学生选题计数
|
|
|
- public static async Task examRecordCount(ExamInfo info, ExamSubject subject, DingDing _dingDing, int no, AzureStorageFactory _azureStorage, ExamResult result)
|
|
|
+ public static async Task examRecordCount(ExamInfo info, ExamSubject subject, DingDing _dingDing, int no, ExamResult result, List<ExamClassResult> classResults, AzureCosmosFactory _azureCosmos)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- string blobcntr = "";
|
|
|
- if (info.scope.Equals("school"))
|
|
|
- {
|
|
|
- blobcntr = info.school;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- blobcntr = info.creatorId;
|
|
|
- }
|
|
|
-
|
|
|
List<double> scores = new List<double>();
|
|
|
foreach (List<double> sc in result.studentScores)
|
|
|
{
|
|
@@ -445,72 +438,144 @@ namespace TEAMModelFunction
|
|
|
}
|
|
|
//确定高分组 最低分数
|
|
|
scores.Sort((s1, s2) => { return s2.CompareTo(s1); });
|
|
|
-
|
|
|
- double rhwCount = scores.Count * 0.27;
|
|
|
+ double rhwCount = Math.Floor(scores.Count * 0.27);
|
|
|
double rhw = rhwCount > 0 ? scores[int.Parse(rhwCount.ToString("0"))] : 0;
|
|
|
- //double rhw = resultSum[int.Parse(rhwCount.ToString("0"))];
|
|
|
//确定低分组 最高分数
|
|
|
- scores.Sort((s1, s2) => { return s1.CompareTo(s2); });
|
|
|
- double rhlCount = scores.Count * 0.27;
|
|
|
+ //scores.Sort((s1, s2) => { return s1.CompareTo(s2); });
|
|
|
+ double rhlCount = Math.Ceiling(scores.Count * 0.73);
|
|
|
double rhl = rhlCount > 0 ? scores[int.Parse(rhlCount.ToString("0"))] : 0;
|
|
|
//存放高分组学生ID
|
|
|
List<string> phId = new List<string>();
|
|
|
List<string> plId = new List<string>();
|
|
|
- foreach (string id in result.studentIds)
|
|
|
+ int phcount = 0;
|
|
|
+ int plcount = 0;
|
|
|
+ List<List<List<string>>> opth = new List<List<List<string>>>();
|
|
|
+ List<List<List<string>>> optl = new List<List<List<string>>>();
|
|
|
+ //存放并去重知识点
|
|
|
+ HashSet<string> kname = new HashSet<string>();
|
|
|
+ info.papers[no].knowledge.ForEach(kno =>
|
|
|
{
|
|
|
- int index = result.studentIds.IndexOf(id);
|
|
|
- if (result.studentScores[index].Sum() >= rhw)
|
|
|
+ kno.ForEach(k =>
|
|
|
{
|
|
|
- phId.Add(id);
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (result.studentScores[index].Sum() <= rhl)
|
|
|
+ kname.Add(k);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ List<string> knowledgeName = new List<string>();
|
|
|
+ foreach (string cla in kname)
|
|
|
+ {
|
|
|
+ knowledgeName.Add(cla);
|
|
|
+ }
|
|
|
+ for (int k = 0; k < knowledgeName.Count; k++)
|
|
|
+ {
|
|
|
+ if (null == knowledgeName[k])
|
|
|
{
|
|
|
- plId.Add(id);
|
|
|
- continue;
|
|
|
+ knowledgeName.Remove(knowledgeName[k]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var ContainerClient = _azureStorage.GetBlobContainerClient(blobcntr);
|
|
|
- List<string> items = await ContainerClient.List($"exam/{info.id}/{subject.id}");
|
|
|
- List<List<List<string>>> ansList = new List<List<List<string>>>();
|
|
|
- List<List<List<string>>> phAnsList = new List<List<List<string>>>();
|
|
|
- List<List<List<string>>> plAnsList = new List<List<List<string>>>();
|
|
|
- List<string> phItems = new List<string>();
|
|
|
- List<string> plItems = new List<string>();
|
|
|
- foreach (string item in items)
|
|
|
+ foreach (ExamClassResult classResult in classResults)
|
|
|
{
|
|
|
- //确定高分组选项内容
|
|
|
- foreach (string id in phId) {
|
|
|
- if (item.Contains($"/{id}/"))
|
|
|
+ if (classResult.subjectId.Equals(subject.id)) {
|
|
|
+ //List<int> phc = new List<int>();
|
|
|
+ List<int> ph = new List<int>();
|
|
|
+ List<int> pl = new List<int>();
|
|
|
+ List<int> pc = new List<int>();
|
|
|
+ List<double> persent = new List<double>();
|
|
|
+ for (int i = 0; i < knowledgeName.Count; i++)
|
|
|
{
|
|
|
- var phDownload = await _azureStorage.GetBlobContainerClient(blobcntr).GetBlobClient(item).DownloadAsync();
|
|
|
- var phjson = await JsonDocument.ParseAsync(phDownload.Value.Content);
|
|
|
- var phRecord = phjson.RootElement.ToObject<List<List<string>>>();
|
|
|
- phAnsList.Add(phRecord);
|
|
|
- break;
|
|
|
+ //初始化单个知识点得分
|
|
|
+ double score = 0;
|
|
|
+ double allScore = 0;
|
|
|
+ int n = 0;
|
|
|
+ int phCount = 0;
|
|
|
+ int plCount = 0;
|
|
|
+ int pCount = 0;
|
|
|
+ foreach (List<string> str in info.papers[no].knowledge)
|
|
|
+ {
|
|
|
+ if (str.Contains(knowledgeName[i]))
|
|
|
+ {
|
|
|
+ var itemPersent = str.Count > 0 ? 1 / Convert.ToDouble(str.Count) : 0;
|
|
|
+ allScore += info.papers[no].point[n] * itemPersent;
|
|
|
+ foreach (string id in classResult.studentIds)
|
|
|
+ {
|
|
|
+ int index = classResult.studentIds.IndexOf(id);
|
|
|
+ if (classResult.studentScores[index].Count > 0)
|
|
|
+ {
|
|
|
+ score += classResult.studentScores[index][n];
|
|
|
+ if (classResult.studentScores[index].Sum() >= rhw && phcount < rhwCount)
|
|
|
+ {
|
|
|
+ if (classResult.studentScores[index][n] == 0)
|
|
|
+ {
|
|
|
+ phCount++;
|
|
|
+ }
|
|
|
+ phcount++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (classResult.studentScores[index].Sum() <= rhl && plcount < (scores.Count - rhlCount))
|
|
|
+ {
|
|
|
+ if (classResult.studentScores[index][n] == 0)
|
|
|
+ {
|
|
|
+ plCount++;
|
|
|
+ }
|
|
|
+ plcount++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (classResult.studentScores[index][n] == 0)
|
|
|
+ {
|
|
|
+ pCount++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ n++;
|
|
|
+ }
|
|
|
+ pc.Add(pCount);
|
|
|
+ ph.Add(phCount);
|
|
|
+ pl.Add(plCount);
|
|
|
+ double per = classResult.studentIds.Count > 0 ? Math.Round(score / classResult.studentIds.Count, 2) : 0;
|
|
|
+ persent.Add(per / allScore);
|
|
|
}
|
|
|
- }
|
|
|
- //确定低分组选项内容
|
|
|
- foreach (string id in plId)
|
|
|
+ classResult.phc = ph;
|
|
|
+ classResult.plc = pl;
|
|
|
+ classResult.pc = pc;
|
|
|
+ classResult.krate = persent;
|
|
|
+ }
|
|
|
+ await _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(classResult, classResult.id, new Azure.Cosmos.PartitionKey($"{classResult.code}"));
|
|
|
+ }
|
|
|
+ //
|
|
|
+ int PHCount = 0;
|
|
|
+ int PLCount = 0;
|
|
|
+ foreach (ExamClassResult classResult in classResults)
|
|
|
+ {
|
|
|
+ if (classResult.subjectId.Equals(subject.id))
|
|
|
{
|
|
|
- if (item.Contains($"/{id}/"))
|
|
|
+ foreach (string id in classResult.studentIds)
|
|
|
{
|
|
|
- var plDownload = await _azureStorage.GetBlobContainerClient(blobcntr).GetBlobClient(item).DownloadAsync();
|
|
|
- var pljson = await JsonDocument.ParseAsync(plDownload.Value.Content);
|
|
|
- var plRecord = pljson.RootElement.ToObject<List<List<string>>>();
|
|
|
- plAnsList.Add(plRecord);
|
|
|
- break;
|
|
|
+ int index = classResult.studentIds.IndexOf(id);
|
|
|
+ if (classResult.studentScores[index].Sum() >= rhw && PHCount < rhwCount)
|
|
|
+ {
|
|
|
+ if (classResult.ans.Count > 0)
|
|
|
+ {
|
|
|
+ opth.Add(classResult.ans[index]);
|
|
|
+ PHCount++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if (classResult.studentScores[index].Sum() <= rhl && PLCount < (scores.Count - rhlCount))
|
|
|
+ {
|
|
|
+ if (classResult.ans.Count > 0)
|
|
|
+ {
|
|
|
+ optl.Add(classResult.ans[index]);
|
|
|
+ PLCount++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- var Download = await _azureStorage.GetBlobContainerClient(blobcntr).GetBlobClient(item).DownloadAsync();
|
|
|
- var json = await JsonDocument.ParseAsync(Download.Value.Content);
|
|
|
- var Record = json.RootElement.ToObject<List<List<string>>>();
|
|
|
- ansList.Add(Record);
|
|
|
}
|
|
|
- result.record = getMore(info, no, ansList);
|
|
|
- result.phc = getMore(info, no, phAnsList);
|
|
|
- result.plc = getMore(info, no, plAnsList);
|
|
|
+ result.phc = getMore(info, no, opth);
|
|
|
+ result.plc = getMore(info, no, optl);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -575,11 +640,16 @@ namespace TEAMModelFunction
|
|
|
List<ClassRange> classRanges = new List<ClassRange>();
|
|
|
List<string> lostStu = new List<string>();
|
|
|
List<double> csRate = new List<double>();
|
|
|
+ List<List<List<string>>> opt = new List<List<List<string>>>();
|
|
|
foreach (ExamClassResult classResult in examClassResults)
|
|
|
{
|
|
|
double classSrate = 0;
|
|
|
if (classResult.subjectId.Equals(subject.id))
|
|
|
{
|
|
|
+ foreach (List<List<string>> op in classResult.ans)
|
|
|
+ {
|
|
|
+ opt.Add(op);
|
|
|
+ }
|
|
|
//记录缺考学生索引位置
|
|
|
int index = 0;
|
|
|
foreach (List<double> scores in classResult.studentScores)
|
|
@@ -633,8 +703,11 @@ namespace TEAMModelFunction
|
|
|
}
|
|
|
csRate.Add(result.studentIds.Count > 0 ? Math.Round(classSrate * 1.0 / classResult.studentIds.Count, 2) : 0 / allScore);
|
|
|
//powSum += Math.Pow(classSrate - result.average, 2);
|
|
|
+ //处理选项计数内容
|
|
|
}
|
|
|
}
|
|
|
+ await examRecordCount(info, subject, _dingDing, no, result, examClassResults, _azureCosmos);
|
|
|
+ result.record = getMore(info, no, opt);
|
|
|
result.average = result.studentIds.Count > 0 ? Math.Round(score * 1.0 / result.studentIds.Count, 2) : 0;
|
|
|
foreach (ExamClassResult classResult in examClassResults)
|
|
|
{
|
|
@@ -650,8 +723,6 @@ namespace TEAMModelFunction
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- //处理选项计数内容
|
|
|
- await examRecordCount(info, subject, _dingDing, no, _azureStorage, result);
|
|
|
result.standard = Math.Round(result.studentIds.Count > 0 ? Math.Pow(powSum / result.studentIds.Count, 0.5) : 0, 2);
|
|
|
result.csRate = csRate;
|
|
|
result.lostStus = lostStu;
|