Pārlūkot izejas kodu

按题阅卷,批阅数据写入

zhouj1203@hotmail.com 3 gadi atpakaļ
vecāks
revīzija
3d647465c2

+ 8 - 2
TEAMModelFunction/TriggerCorrect.cs

@@ -92,7 +92,12 @@ namespace TEAMModelFunction
                                             //结束时间
                                             //结束时间
                                             endTime=correct.endTime,
                                             endTime=correct.endTime,
                                             //批改数量
                                             //批改数量
-                                            count=marker.count
+                                            count=marker.count,
+                                            //按题阅卷时,题号
+                                            qu = marker.qu,
+                                            //模块术
+                                            modle = correct.modle
+                                            //type = correct.isArb
                                         };
                                         };
                                        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));
                                     }
                                     }
@@ -199,7 +204,8 @@ namespace TEAMModelFunction
                                                 scores = examClass.studentScores[index],
                                                 scores = examClass.studentScores[index],
                                                 //tIds = tmds,
                                                 //tIds = tmds,
                                                 marks = marks,
                                                 marks = marks,
-                                                items = items
+                                                items = items,
+                                                modle = correct.modle
 
 
                                             };
                                             };
                                             tasks.Add(client.GetContainer("TEAMModelOS", "Teacher").CreateItemAsync<Scoring>(sc, new Azure.Cosmos.PartitionKey(sc.code)));
                                             tasks.Add(client.GetContainer("TEAMModelOS", "Teacher").CreateItemAsync<Scoring>(sc, new Azure.Cosmos.PartitionKey(sc.code)));

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

@@ -19,6 +19,7 @@ namespace TEAMModelOS.SDK.Models.Cosmos.Common
         public List<string> tIds { get; set; } = new List<string>();
         public List<string> tIds { get; set; } = new List<string>();
         public List<string> marks { get; set; } = new List<string>();
         public List<string> marks { get; set; } = new List<string>();
         public List<double> scores { get; set; } = new List<double>();
         public List<double> scores { get; set; } = new List<double>();
+        public int modle { get; set; }
     }
     }
 
 
     public class Item
     public class Item

+ 2 - 0
TEAMModelOS.SDK/Models/Cosmos/Teacher/CorrectTask.cs

@@ -41,5 +41,7 @@ namespace TEAMModelOS.SDK.Models
         public List<int> qu { get; set; } = new List<int>();
         public List<int> qu { get; set; } = new List<int>();
         //阅卷类型
         //阅卷类型
         public string type { get; set; }
         public string type { get; set; }
+        //模块数
+        public int modle { get; set; }
     }
     }
 }
 }

+ 28 - 14
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -1598,7 +1598,7 @@ namespace TEAMModelOS.Controllers
                     {
                     {
                         recs.Add(scoring);
                         recs.Add(scoring);
                     }
                     }
-                    else if (scoring.tIds.Count < scoring.marks.Count)
+                    else if (scoring.tIds.Count < scoring.marks.Count * scoring.modle)
                     {
                     {
                         all.Add(scoring);
                         all.Add(scoring);
                     }
                     }
@@ -1691,7 +1691,7 @@ namespace TEAMModelOS.Controllers
                         Random random = new Random();
                         Random random = new Random();
                         SDK.Models.Cosmos.Common.Scoring item = new();
                         SDK.Models.Cosmos.Common.Scoring item = new();
                         List<SDK.Models.Cosmos.Common.Scoring> notYet = new();
                         List<SDK.Models.Cosmos.Common.Scoring> notYet = new();
-                        notYet =  all.Where(x => x.tIds.Count < x.marks.Count - 1).ToList();
+                        notYet =  all.Where(x => x.tIds.Count < x.marks.Count * x.modle - 1).ToList();
                         if (notYet.Count > 0)
                         if (notYet.Count > 0)
                         {
                         {
                             item = notYet[random.Next(notYet.Count)];
                             item = notYet[random.Next(notYet.Count)];
@@ -1833,20 +1833,41 @@ namespace TEAMModelOS.Controllers
                 if (requert.TryGetProperty("mark", out JsonElement mark))
                 if (requert.TryGetProperty("mark", out JsonElement mark))
                 {
                 {
                     //存放老师批注信息到blob                   
                     //存放老师批注信息到blob                   
-                    builder.Append(id).Append("/");
-                    builder.Append(subjectId).Append("/");
-                    builder.Append(sId).Append("mark").Append("/");
+                    builder.Append(id).Append('/');
+                    builder.Append(subjectId).Append('/');
+                    builder.Append(sId).Append("mark").Append('/');
                     builder.Append("ans.json");
                     builder.Append("ans.json");
                     await _azureStorage.UploadFileByContainer(code.ToString(), mark.ToJsonString(), "exam", builder.ToString(), false);
                     await _azureStorage.UploadFileByContainer(code.ToString(), mark.ToJsonString(), "exam", builder.ToString(), false);
                     if (attr.Count > 0)
                     if (attr.Count > 0)
                     {
                     {
                         foreach (SDK.Models.Cosmos.Common.Scoring scoring in attr)
                         foreach (SDK.Models.Cosmos.Common.Scoring scoring in attr)
                         {
                         {
-                            int index = scoring.tIds.IndexOf(tId.GetString());
+                            foreach (Item item in scoring.items) {
+                                bool flag = false;
+                                int index = 0;
+                                if (item.scores.Count > 0) {
+                                    foreach (Info info in item.scores) {
+                                        if (!info.tmdId.Equals(tId.GetString()))
+                                        {
+                                            index++;
+                                        }
+                                        else {
+                                            scoring.marks[index] = builder.ToString();
+                                            flag = true;
+                                            break;
+                                        }
+                                    }
+                                }
+                                if (flag) {
+                                    break;
+                                }
+                                 //List<Info> info = item.scores.Where(x => x.tmdId.Equals(tId.GetString())).ToList();
+                            }
+                           /* int index = scoring.tIds.IndexOf(tId.GetString());
                             if (index != -1)
                             if (index != -1)
                             {
                             {
                                 scoring.marks[index] = builder.ToString();
                                 scoring.marks[index] = builder.ToString();
-                            }
+                            }*/
 
 
                         }
                         }
                     }
                     }
@@ -1874,13 +1895,6 @@ namespace TEAMModelOS.Controllers
                                 info.index = itemIndex;
                                 info.index = itemIndex;
                             }
                             }
                             itemIndex++;
                             itemIndex++;
-                            /*if (tIdIndex > -1)
-                            {
-                                item.scores[tIdIndex].sc = ssc[itemIndex];
-                                item.scores[tIdIndex].tmdId = tId.GetString();
-                                itemIndex++;
-                            }*/
-
                         }
                         }
                         await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync(scoring, scoring.id, new PartitionKey(scoring.code));
                         await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync(scoring, scoring.id, new PartitionKey(scoring.code));