zhouj1203@hotmail.com 4 gadi atpakaļ
vecāks
revīzija
abd6415ccf

+ 2 - 2
TEAMModelFunction/MonitorCosmosDB.cs

@@ -126,11 +126,11 @@ namespace TEAMModelFunction
                                                         using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
                                                         Class classroom = json.ToObject<Class>();
                                                         result.info.name = classroom.name;
-                                                        List<List<string>> ans = new List<List<string>>();
+                                                        List<string> ans = new List<string>();
                                                         List<double> ansPoint = new List<double>();
                                                         foreach (double p in info.papers[m].point)
                                                         {
-                                                            ans.Add(new List<string>());
+                                                            //ans.Add(new List<string>());
                                                             ansPoint.Add(-1);
                                                         }
                                                         foreach (StudentSimple stu in classroom.students)

+ 2 - 3
TEAMModelOS.SDK/Models/Cosmos/Common/ExamClassResult.cs

@@ -11,11 +11,10 @@ namespace TEAMModelOS.SDK.Models
     {
         public ExamClassResult() {
             pk = "ExamClassResult";
-            studentAnswers = new List<List<List<string>>>();
+            studentAnswers = new List<List<string>>();
             studentScores = new List<List<double>>();
             info = new ClassInfo();
             studentIds = new List<string>();
-            studentAnswers = new List<List<List<string>>>();
             studentScores = new List<List<double>>();
             sum = new List<double>();
         }
@@ -28,7 +27,7 @@ namespace TEAMModelOS.SDK.Models
         //public PaperSimple paper { get; set; }
         //public List<double> point { get; set; }
         public List<string> studentIds { get; set; }
-        public List<List<List<string>>> studentAnswers { get; set; }
+        public List<List<string>> studentAnswers { get; set; }
         public List<List<double>> studentScores { get; set; }
         public string scope { get; set; }
         public List<double> sum { get; set; }

+ 9 - 12
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -338,18 +338,15 @@ namespace TEAMModelOS.Controllers
                     {
                         result.studentIds.Add(studentId.ToString());
                         result.studentScores.Add(new List<double>());
-                        result.studentAnswers.Add(new List<List<string>>());
+                        result.studentAnswers.Add(new List<string>());
                     }
+                    string FileName = studentId + "-" + result.examId + "-" + result.subjectId;
+                    string blob = await _azureStorage.UploadFileByContainer("hbcn", ans.ToJsonString(), "exam", FileName + ".json");
+                    result.studentAnswers[index].Add(blob);
+
                     for (int i = 0; i < ans.Count; i++)
-                    {
-                        if(standard[i].Count == 0 && ans[i].Count > 0)
-                        {
-                            string FileName = studentId + "-" + i.ToString() + "-" + result.examId + "-" + result.subjectId ;
-                            string blob = await _azureStorage.UploadFileByContainer("hbcn", ans[i].ToJsonString(), "exam", FileName + ".json");
-                            result.studentAnswers[index][i].Add(blob);
-                            continue;
-                        }
-                        result.studentAnswers[index][i] = ans[i];
+                    {                         
+                        //result.studentAnswers[index][i] = ans[i];
                         //算分处理
                         if (standard[i].Count > 0)
                         {
@@ -749,7 +746,7 @@ namespace TEAMModelOS.Controllers
                         }
                     }
                 }
-                //List<List<List<string>>> stuAns = new List<List<List<string>>>();
+                List<List<string>> stuAns = new List<List<string>>();
                 List<List<double>> stuScore = new List<List<double>>();
                 List<double> total = new List<double>();
                 if (answers.Count > 0)
@@ -760,7 +757,7 @@ namespace TEAMModelOS.Controllers
                         {
                             break;
                         }
-                       // stuAns.Add(result.studentAnswers[index]);
+                        stuAns.Add(result.studentAnswers[index]);
                         stuScore.Add(result.studentScores[index]);
                         total.Add(result.sum.Where(s => s <= 59).Count());
                         total.Add(result.sum.Where(s => s > 59 && s <= 70 ).Count());