|
@@ -337,6 +337,7 @@ namespace TEAMModelOS.Controllers
|
|
|
id = p.studentId,
|
|
|
name = p.studentName,
|
|
|
school = sc.Where(x => x.id.Equals(p.school)).FirstOrDefault().name,
|
|
|
+ code = p.school,
|
|
|
info = p.results.Select(c => new
|
|
|
{
|
|
|
c.score,
|
|
@@ -405,16 +406,15 @@ namespace TEAMModelOS.Controllers
|
|
|
return Ok(new { code = 200, students });
|
|
|
}
|
|
|
|
|
|
- [HttpPost("fix_exam_paper")]
|
|
|
+ [HttpPost("fix-exam-paper")]
|
|
|
//[Authorize(Roles = "IES")]
|
|
|
//[AuthToken(Roles = "teacher,admin,business")]
|
|
|
[RequestSizeLimit(102_400_000_00)] //最大10000m左右
|
|
|
- public async Task<IActionResult> fixExamPaper([FromForm] IFormFile file)
|
|
|
+ public async Task<IActionResult> fixExamPaper(JsonElement json)
|
|
|
{
|
|
|
- ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
- //string stusql = "select * from c where c.pk = 'Art' and c.pId in ('2f74d38e-80c1-4c55-9dd0-de0d8f6fdf6d','306fa576-7ae4-4baa-ac24-0b5ad4dd1bc2')";
|
|
|
- string stusql = "select * from c where c.pk = 'Art' and c.pId = '306fa576-7ae4-4baa-ac24-0b5ad4dd1bc2'";
|
|
|
+ string stusql = "select * from c where c.pk = 'Art' and c.pId in ('2f74d38e-80c1-4c55-9dd0-de0d8f6fdf6d','306fa576-7ae4-4baa-ac24-0b5ad4dd1bc2')";
|
|
|
+ //string stusql = "select * from c where c.pk = 'Art' and c.pId = '306fa576-7ae4-4baa-ac24-0b5ad4dd1bc2'";
|
|
|
List<ArtEvaluation> art = new List<ArtEvaluation>();
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Common).GetItemQueryIterator<ArtEvaluation>(queryText: stusql))
|
|
|
{
|
|
@@ -486,23 +486,24 @@ namespace TEAMModelOS.Controllers
|
|
|
string value = "";
|
|
|
string code = "";
|
|
|
try {
|
|
|
- int n = 0;
|
|
|
+ //int n = 0;
|
|
|
var activity = stus.Where(c => c.id.Equals(classResult.examId)).ToList();
|
|
|
- List<(string studentId, string blob)> stuBlob = new();
|
|
|
+ //List<(string studentId, string blob)> stuBlob = new();
|
|
|
foreach (StuActivity stu in activity) {
|
|
|
List<string> tas = stu.code.Split('-').ToList();
|
|
|
JsonElement dict = stu.paper;
|
|
|
dict[0].TryGetProperty("blob", out JsonElement element);
|
|
|
string blob = element.ToString();
|
|
|
-
|
|
|
+ int index = classResult.studentIds.IndexOf(tas[2]);
|
|
|
+ if (index != -1)
|
|
|
+ {
|
|
|
+ classResult.paper[index] = blob;
|
|
|
+ }
|
|
|
}
|
|
|
- /*foreach (var stuId in classResult.studentIds) {
|
|
|
-
|
|
|
- classResult.paper = stus.Where(c => c.school.Equals(classResult.school) && c.);
|
|
|
- n++;
|
|
|
- }*/
|
|
|
- } catch (Exception e) {
|
|
|
-
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, Constant.Common).ReplaceItemAsync(classResult, classResult.id, new PartitionKey(classResult.code));
|
|
|
+ } catch (Exception e) {
|
|
|
+ value = classResult.examId;
|
|
|
+ code = classResult.school;
|
|
|
}
|
|
|
|
|
|
yield return (code, value);
|
|
@@ -604,14 +605,14 @@ namespace TEAMModelOS.Controllers
|
|
|
List<Task<ItemResponse<ArtEvaluation>>> tasks = new List<Task<ItemResponse<ArtEvaluation>>>();
|
|
|
foreach (ArtEvaluation evaluation in art)
|
|
|
{
|
|
|
- evaluation.endTime = 1706716800000;
|
|
|
+ evaluation.endTime = 1709222400000;
|
|
|
tasks.Add(client.GetContainer(Constant.TEAMModelOS, Constant.Common).ReplaceItemAsync(evaluation, evaluation.id, new PartitionKey(evaluation.code)));
|
|
|
}
|
|
|
await tasks.TaskPage(10);
|
|
|
List<Task<ItemResponse<ExamInfo>>> taskInfo = new List<Task<ItemResponse<ExamInfo>>>();
|
|
|
foreach (ExamInfo info in infos)
|
|
|
{
|
|
|
- info.endTime = 1706716800000;
|
|
|
+ info.endTime = 1709222400000;
|
|
|
taskInfo.Add(client.GetContainer(Constant.TEAMModelOS, Constant.Common).ReplaceItemAsync(info, info.id, new PartitionKey(info.code)));
|
|
|
}
|
|
|
await taskInfo.TaskPage(10);
|