Procházet zdrojové kódy

update hiteach回传不正常 预处理 处理区级数据不正常显示

zhouj1203@hotmail.com před 1 rokem
rodič
revize
5ac0e709cb

+ 8 - 2
TEAMModelOS.FunctionV4/CosmosDB/TriggerExam.cs

@@ -1414,10 +1414,16 @@ namespace TEAMModelOS.FunctionV4
                     {
                         List<double> newScores = new List<double>();
                         //int count = 0;
-                        foreach (double sc in scores)
+                        if (scores.Count > 0)
                         {
-                            newScores.Add(sc > -1 ? sc : 0);
+                            foreach (double sc in scores)
+                            {
+                                newScores.Add(sc > -1 ? sc : 0);
+                            }
                         }
+                        else {
+                            newScores.Add(0);
+                        }                      
                         classSrate += newScores.Sum();
                         score += newScores.Sum();
                         result.studentScores.Add(newScores);

+ 1 - 1
TEAMModelOS/Controllers/Common/AreaController.cs

@@ -1167,7 +1167,7 @@ namespace TEAMModelOS.Controllers
                 }
             }
             List<(string code, string name, List<Period> pd)> schoolBase = new();
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.School).GetItemQueryStreamIterator(queryText: $"select c.id,c.name from c", requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Base") }))
+            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.School).GetItemQueryStreamIterator(queryText: $"select c.id,c.name,c.period from c  where c.areaId = '{id}'", requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Base") }))
             {
                 using var sjson = await JsonDocument.ParseAsync(item.ContentStream);
                 if (sjson.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)