瀏覽代碼

调整批注初始化内容已经相应的存储内容

zhouj1203@hotmail.com 4 年之前
父節點
當前提交
1e8a4ad169

+ 2 - 1
TEAMModelFunction/TriggerExam.cs

@@ -272,12 +272,13 @@ namespace TEAMModelFunction
                                 }
                                 foreach (string stu in ids)
                                 {
+                                    result.mark.Add("");
                                     result.studentIds.Add(stu);
                                     result.studentAnswers.Add(ans);
                                     result.studentScores.Add(ansPoint);
                                     result.sum.Add(0);
                                 }
-
+                                
                                 //result.progress = info.progress;
                                 result.school = info.school;
                                 m++;

+ 1 - 1
TEAMModelOS.SDK/Models/Cosmos/Common/ExamClassResult.cs

@@ -31,7 +31,7 @@ namespace TEAMModelOS.SDK.Models
         public List<List<string>> studentAnswers { get; set; }
         public List<List<double>> studentScores { get; set; }
         //Åú×¢
-        public List<string> mark { get; set; }
+        public List<string> mark { get; set; } = new List<string>();
         public string scope { get; set; }
         public List<double> sum { get; set; }
         public double average { get; set; }

+ 7 - 1
TEAMModelOS/Controllers/Teacher/CommentController.cs

@@ -171,7 +171,13 @@ namespace TEAMModelOS.Controllers
                     int index = result.studentIds.IndexOf(studentId.ToString());
                     string FileName = result.examId + "/" + result.subjectId + "/" + studentId;
                     string blob = await _azureStorage.UploadFileByContainer(school.ToString(), ans.ToJsonString(), "exam", FileName + "/" + "ans.json");
-                    result.studentAnswers[index].Add(blob);                  
+                    //result.studentAnswers[index].Add(blob);
+                    if (result.mark.Count == 0) {
+                        foreach (string ids in result.studentIds) {
+                            result.mark.Add("");
+                        }
+                    }
+                    result.mark[index] = blob;
                     classResult = await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(result, result.id, new PartitionKey($"{result.code}"));
                 }