Sfoglia il codice sorgente

新增异常 仲裁卷查询 以及异常信息更新

zhouj1203@hotmail.com 3 anni fa
parent
commit
3bb6d1d96d

+ 3 - 15
TEAMModelFunction/TriggerCorrect.cs

@@ -103,21 +103,9 @@ namespace TEAMModelFunction
                                             //按题阅卷时,题号
                                             //按题阅卷时,题号
                                             qu = marker.qu,
                                             qu = marker.qu,
                                             //模块术
                                             //模块术
-                                            model = sub.model
-                                            //type = correct.isArb
+                                            model = sub.model,
+                                            type = 1
                                         };
                                         };
-                                        if (correct.isArb == 1)
-                                        {
-                                            task.type = 3;
-                                        }
-                                        else if (correct.isErr == 1)
-                                        {
-                                            task.type = 2;
-                                        }
-                                        else
-                                        {
-                                            task.type = 1;
-                                        }
                                         await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<CorrectTask>(task, new Azure.Cosmos.PartitionKey(task.code));
                                         await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<CorrectTask>(task, new Azure.Cosmos.PartitionKey(task.code));
                                     }
                                     }
                                 }
                                 }
@@ -127,7 +115,7 @@ namespace TEAMModelFunction
                                 if (sub.err.IsNotEmpty())
                                 if (sub.err.IsNotEmpty())
                                 {
                                 {
 
 
-                                    foreach (var tId in sub.arb)
+                                    foreach (var tId in sub.err)
                                     {
                                     {
                                         CorrectTask task = new CorrectTask
                                         CorrectTask task = new CorrectTask
                                         {
                                         {

+ 1 - 0
TEAMModelOS.SDK/Models/Cosmos/Common/Scoring.cs

@@ -23,6 +23,7 @@ namespace TEAMModelOS.SDK.Models.Cosmos.Common
         public string mode { get; set; }
         public string mode { get; set; }
         //阅卷类型1 正常卷 2 异常卷 3 仲裁卷
         //阅卷类型1 正常卷 2 异常卷 3 仲裁卷
         public int type { get; set; }
         public int type { get; set; }
+        public string err { get; set; }
 
 
     }
     }
 
 

+ 50 - 1
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -1867,7 +1867,7 @@ namespace TEAMModelOS.Controllers
                 //if (!requert.TryGetProperty("mark", out JsonElement mark)) return BadRequest();
                 //if (!requert.TryGetProperty("mark", out JsonElement mark)) return BadRequest();
                 //requert.TryGetProperty("mark", out JsonElement mark);
                 //requert.TryGetProperty("mark", out JsonElement mark);
                 var client = _azureCosmos.GetCosmosClient();
                 var client = _azureCosmos.GetCosmosClient();
-                var redisClient = _azureRedis.GetRedisClient(8);
+                //var redisClient = _azureRedis.GetRedisClient(8);
                 List<ExamClassResult> classResults = new();
                 List<ExamClassResult> classResults = new();
                 List<SDK.Models.Cosmos.Common.Scoring> attr = new();
                 List<SDK.Models.Cosmos.Common.Scoring> attr = new();
                 await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<SDK.Models.Cosmos.Common.Scoring>(
                 await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<SDK.Models.Cosmos.Common.Scoring>(
@@ -2035,6 +2035,8 @@ namespace TEAMModelOS.Controllers
                                 //判定是否仲裁卷
                                 //判定是否仲裁卷
                                 if (!item.flag)
                                 if (!item.flag)
                                 {
                                 {
+                                    scoring.type = 3;
+                                    await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync(scoring, scoring.id, new PartitionKey(scoring.code));
                                     return Ok(new { msg = "试题分数差异过大" });
                                     return Ok(new { msg = "试题分数差异过大" });
                                 }
                                 }
                                 double sc = item.scores.Select(x => x.sc).ToList().Aggregate((i, j) => (i + j) / item.scores.Count);
                                 double sc = item.scores.Select(x => x.sc).ToList().Aggregate((i, j) => (i + j) / item.scores.Count);
@@ -2062,6 +2064,53 @@ namespace TEAMModelOS.Controllers
             }
             }
 
 
         }
         }
+
+        //查询阅卷类型数据
+        [ProducesDefaultResponseType]
+        //[AuthToken(Roles = "Student")]
+        [HttpPost("find-scoring")]
+        public async Task<IActionResult> findScoring(JsonElement requert)
+        {
+            if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
+            if (!requert.TryGetProperty("stuId", out JsonElement sId)) return BadRequest();
+            if (!requert.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
+            if (!requert.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
+            if (!requert.TryGetProperty("type", out JsonElement type)) return BadRequest();
+            if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
+            var client = _azureCosmos.GetCosmosClient();
+            List<SDK.Models.Cosmos.Common.Scoring> attr = new();
+            await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<SDK.Models.Cosmos.Common.Scoring>(
+                                queryText: $"select value(c) from c where c.examId = '{id}' and c.subjectId = '{subjectId}' and c.stuId = '{sId}' and c.type = '{type}' and array_contains(c.tIds,'{tId}') ",
+                                requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Scoring-{code}") }))
+            {
+                attr.Add(item);
+            }
+            return Ok(attr);
+        }
+
+        //查询阅卷类型数据
+        [ProducesDefaultResponseType]
+        //[AuthToken(Roles = "Student")]
+        [HttpPost("save-err")]
+        public async Task<IActionResult> saveErr(JsonElement requert)
+        {
+            if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
+            if (!requert.TryGetProperty("err", out JsonElement err)) return BadRequest();
+            if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
+            var client = _azureCosmos.GetCosmosClient();
+            SDK.Models.Cosmos.Common.Scoring scoring = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<SDK.Models.Cosmos.Common.Scoring>(id.GetString(), new PartitionKey($"Scoring-{code}"));
+            if (null != scoring)
+            {
+                scoring.type = 2;
+                scoring.err = err.GetString();
+            }
+            else {
+                return Ok(new { code = 404 });
+            }
+
+            return Ok( new { code = 200 });
+        }
+
         //阅卷信息统计
         //阅卷信息统计
         [ProducesDefaultResponseType]
         [ProducesDefaultResponseType]
         //[AuthToken(Roles = "Student")]
         //[AuthToken(Roles = "Student")]