Browse Source

ServiceBus调整 以及评测结构完善

liqk 4 years ago
parent
commit
eb89576b67

+ 5 - 5
TEAMModelFunction/MonitorCosmosDB.cs

@@ -65,7 +65,7 @@ namespace TEAMModelFunction
 
                         //await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(exams[i], exams[i].id.ToString(), new Azure.Cosmos.PartitionKey($"{exams[i].code}"));
                         for (int j = 0;i< exams[i].subjects.Count;j++) {
-                            for (int k = 0; k < exams[i].targetClasseIds.Count; k++) {                         
+                            for (int k = 0; k < exams[i].targetClassIds.Count; k++) {                         
                                 ExamClassResult result = new ExamClassResult();
                                 result.code = "ExamClassResult-" + exams[i].school;
                                 result.examId = exams[i].id;
@@ -73,17 +73,17 @@ namespace TEAMModelFunction
                                 result.subjectId = exams[i].subjects[j].id;
                                 result.year = exams[i].year;
                                 result.ttl = -1;
-                                result.info.id = exams[i].targetClasseIds[k];
-                                var sresponse = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(exams[i].targetClasseIds[k], new Azure.Cosmos.PartitionKey($"Class-{exams[i].school}"));
+                                result.info.id = exams[i].targetClassIds[k];
+                                var sresponse = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(exams[i].targetClassIds[k], new Azure.Cosmos.PartitionKey($"Class-{exams[i].school}"));
                                 if (sresponse.Status == 200)
                                 {
                                     using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
                                     Classroom classroom = json.ToObject<Classroom>();
                                     result.info.name = classroom.name;
-                                    List<string> ans = new List<string>();
+                                    List<List<string>> ans = new List<List<string>>();
                                     List<double> ansPoint = new List<double>();
                                     foreach (double p in exams[i].papers[j].point) {
-                                        ans.Add("");
+                                        ans.Add(new List<string>());
                                         ansPoint.Add(0);
                                     }
                                     foreach (StudentSimple stu in classroom.students) {

+ 1 - 1
TEAMModelFunction/ServiceBusTopic.cs

@@ -29,7 +29,7 @@ namespace TEAMModelFunction
             keyValuePairs.TryGetValue("name", out object name);
             keyValuePairs.TryGetValue("code", out object code);
             keyValuePairs.TryGetValue("status", out object progress);
-            if (name.ToJsonString().Equals("Exam")) {
+            if (name.ToString().Equals("ExamInfo")) {
                 ExamInfo exam = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"{code}"));
                 exam.progress = progress.ToString();
                 await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(exam, id.ToString(), new PartitionKey($"{code}"));

+ 2 - 2
TEAMModelOS/Models/CommonInfo/ExamClassResult.cs

@@ -12,7 +12,7 @@ namespace TEAMModelOS.Models.CommonInfo
     {
         public ExamClassResult() {
             //paper = new PaperSimple();
-            studentAnswers = new List<List<string>>();
+            studentAnswers = new List<List<List<string>>>();
             studentScores = new List<List<double>>();
         }
         public string pk { get; set; }
@@ -28,7 +28,7 @@ namespace TEAMModelOS.Models.CommonInfo
         //public PaperSimple paper { get; set; }
         //public List<double> point { get; set; }
         public List<string> studentIds { get; set; }
-        public List<List<string>> studentAnswers { get; set; }
+        public List<List<List<string>>> studentAnswers { get; set; }
         public List<List<double>> studentScores { get; set; }
         public string scope { get; set; }
         public int? ttl { get; set; }

+ 1 - 1
TEAMModelOS/Models/SchoolInfo/ExamInfo.cs

@@ -65,7 +65,7 @@ namespace TEAMModelOS.Models.SchoolInfo
         public int year { get; set; }
         public string range { get; set; }
         public string source { get; set; }
-        public List<string> targetClasseIds { get; set; }
+        public List<string> targetClassIds { get; set; }
         public List<PaperSimple> papers { get; set; }
         ///考试类型 段考 stage  联考 union 平常考 normal 其他 other
         /// </summary>