Browse Source

处理阅卷打分的问题

zhouj1203@hotmail.com 4 năm trước cách đây
mục cha
commit
65b46978cd

+ 5 - 1
TEAMModelFunction/TriggerCorrect.cs

@@ -145,9 +145,12 @@ namespace TEAMModelFunction
                                 List<Task<ItemResponse<Scoring>>> tasks = new List<Task<ItemResponse<Scoring>>>();
                                 //初始化老师阅卷记录
                                 //List<string> tmds = new List<string>();
+                                List<Info> infos = new List<Info>();
                                 List<string> marks = new List<string>();
                                 for (int i = 0; i < correct.num; i++) {
                                     //tmds.Add("");
+                                    Info fo = new Info();
+                                    infos.Add(fo);
                                     marks.Add("");
                                 }
                                 //初始化阅卷试题部分数据
@@ -155,7 +158,8 @@ namespace TEAMModelFunction
                                 foreach (double psc in paperPoint) {
                                     Item item = new Item
                                     {
-                                       ssc = psc
+                                       ssc = psc,
+                                       scores = infos
                                     };
                                     items.Add(item);
                                 }

+ 3 - 6
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -1846,15 +1846,12 @@ namespace TEAMModelOS.Controllers
                     foreach (SDK.Models.Cosmos.Common.Scoring scoring in attr)
                     {
                         int itemIndex = 0;
+                        int tIdIndex = scoring.tIds.IndexOf(tId.GetString());
                         foreach (Item item in scoring.items)
                         {
-                            Info info = new()
-                            {
-                                sc = ssc[itemIndex],
-                                tmdId = tId.ToString()
-                            };
+                            item.scores[tIdIndex].sc = ssc[itemIndex];
+                            item.scores[tIdIndex].tmdId = tId.GetString();
                             itemIndex++;
-                            item.scores.Add(info);
                         }
                         await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync(scoring, scoring.id, new PartitionKey(scoring.code));