|
@@ -472,6 +472,7 @@ namespace TEAMModelOS.Controllers
|
|
});
|
|
});
|
|
await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(exam, id.ToString(), new PartitionKey($"Exam-{school}"));
|
|
await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(exam, id.ToString(), new PartitionKey($"Exam-{school}"));
|
|
}
|
|
}
|
|
|
|
+ examClassResults[0].sum[index] = examClassResults[0].studentScores[index].Sum();
|
|
classResult = await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(examClassResults[0], examClassResults[0].id, new PartitionKey($"{examClassResults[0].code}"));
|
|
classResult = await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(examClassResults[0], examClassResults[0].id, new PartitionKey($"{examClassResults[0].code}"));
|
|
return Ok(new { classResult });
|
|
return Ok(new { classResult });
|
|
}
|
|
}
|
|
@@ -561,6 +562,7 @@ namespace TEAMModelOS.Controllers
|
|
exam.updateTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
exam.updateTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(exam, id.ToString(), new PartitionKey($"Exam-{school}"));
|
|
await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(exam, id.ToString(), new PartitionKey($"Exam-{school}"));
|
|
}
|
|
}
|
|
|
|
+ examClassResults[0].sum[index] = examClassResults[0].studentScores[index].Sum();
|
|
classResult = await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(examClassResults[0], examClassResults[0].id, new PartitionKey($"{examClassResults[0].code}"));
|
|
classResult = await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(examClassResults[0], examClassResults[0].id, new PartitionKey($"{examClassResults[0].code}"));
|
|
return Ok(new { classResult });
|
|
return Ok(new { classResult });
|
|
}
|
|
}
|
|
@@ -729,20 +731,25 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
List<List<List<string>>> stuAns = new List<List<List<string>>>();
|
|
List<List<List<string>>> stuAns = new List<List<List<string>>>();
|
|
List<List<double>> stuScore = new List<List<double>>();
|
|
List<List<double>> stuScore = new List<List<double>>();
|
|
|
|
+ List<double> total = new List<double>();
|
|
if (answers.Count > 0)
|
|
if (answers.Count > 0)
|
|
{
|
|
{
|
|
- for (int i = 0; i < answers.Count; i++)
|
|
|
|
- {
|
|
|
|
- int index = answers[i].studentIds.IndexOf(studentId.ToString());
|
|
|
|
|
|
+ foreach (ExamClassResult result in answers) {
|
|
|
|
+ int index = result.studentIds.IndexOf(studentId.ToString());
|
|
if (index == -1)
|
|
if (index == -1)
|
|
{
|
|
{
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- stuAns.Add(answers[i].studentAnswers[index]);
|
|
|
|
- stuScore.Add(answers[i].studentScores[index]);
|
|
|
|
- }
|
|
|
|
|
|
+ stuAns.Add(result.studentAnswers[index]);
|
|
|
|
+ stuScore.Add(result.studentScores[index]);
|
|
|
|
+ total.Add(result.sum.GroupBy(s => s <= 59).Count());
|
|
|
|
+ total.Add(result.sum.GroupBy(s => s > 59 && s <= 70 ).Count());
|
|
|
|
+ total.Add(result.sum.GroupBy(s => s > 70 && s <= 80).Count());
|
|
|
|
+ total.Add(result.sum.GroupBy(s => s > 80 && s <= 90).Count());
|
|
|
|
+ total.Add(result.sum.GroupBy(s => s > 90 && s <= 100).Count());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- return Ok(new { props, stuAns ,stuScore});
|
|
|
|
|
|
+ return Ok(new { props, stuAns ,stuScore, total });
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|