Browse Source

提前结算

zhouj1203@hotmail.com 4 years ago
parent
commit
ecfbb13622
1 changed files with 12 additions and 3 deletions
  1. 12 3
      TEAMModelFunction/MonitorCosmosDB.cs

+ 12 - 3
TEAMModelFunction/MonitorCosmosDB.cs

@@ -172,12 +172,21 @@ namespace TEAMModelFunction
                                                 //await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
                                             }
                                         }
+                                        else {
+                                            for (int j = 0; j < info.subjects.Count; j++)
+                                            {
+                                                if (info.subjects[j].classCount == info.targetClassIds.Count)
+                                                {
+                                                    info.progress = "finish";
+                                                    await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(info, info.id, new Azure.Cosmos.PartitionKey($"{code}"));
+                                                }
+                                            }
+                                        }
                                         break;
                                     case "finish":
                                         for (int j = 0; j < info.subjects.Count; j++)
                                         {
-                                            if (info.subjects[j].classCount == info.targetClassIds.Count)
-                                            {
+                                            
                                                 ExamResult result = new ExamResult();
                                                 //人数总和
                                                 int Count = 0;
@@ -233,7 +242,7 @@ namespace TEAMModelFunction
                                                 result.time = info.startTime;
                                                 result.ttl = -1;
                                                 await _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Common").UpsertItemAsync(result, new Azure.Cosmos.PartitionKey($"ExamResult-{info.id}"));
-                                            }
+                                            
                                         }
                                         break;
                                 }