zhouj1203@hotmail.com 2 years ago
parent
commit
b4af412e79

+ 3 - 3
TEAMModelOS.FunctionV4/CosmosDB/TriggerArt.cs

@@ -353,7 +353,7 @@ namespace TEAMModelOS.FunctionV4.CosmosDB
                                 var artResponse = await client.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync($"{scInfo.areaId}", partitionKey: new Azure.Cosmos.PartitionKey("ArtSetting"));
                                 if (response.Status == 200)
                                 {
-                                    using var json = await JsonDocument.ParseAsync(response.ContentStream);
+                                    using var json = await JsonDocument.ParseAsync(artResponse.ContentStream);
                                     setting = json.ToObject<ArtSetting>();
                                 }
                             }
@@ -402,11 +402,11 @@ namespace TEAMModelOS.FunctionV4.CosmosDB
                                             }).Sum(n => n.real) * c.percent * 0.01
                                         }).Sum(n => n.real + n.score) * x.percent * 0.01
                                     });
-                                    double realScore = Math.Round((double)quotaPercent.Sum(c => c.score));                                   
+                                    double realScore = Math.Round((double)quotaPercent.Sum(c => c.score),2);                                   
                                     sc.score = realScore;
                                     //}
                                 }
-                                rs.totalScore = rs.subjectScores.Where(m => m.score >= 0).Sum(z => z.score);
+                                rs.totalScore = Math.Round(rs.subjectScores.Where(m => m.score >= 0).Sum(z => z.score),2);
                                 tasks.Add(client.GetContainer(Constant.TEAMModelOS, Constant.Student).ReplaceItemAsync(rs, rs.id, new PartitionKey(rs.code)));
                                 //}
                             }

+ 1 - 1
TEAMModelOS/Controllers/Analysis/ArtAnalysisController.cs

@@ -130,7 +130,7 @@ namespace TEAMModelOS.Controllers.Analysis
                 }
                 var subjectScore = new
                 {
-                    name = As.Where(a => a.subjectId.Equals(subjectId.GetString())).Select(x => x.score)
+                    name = As.Where(a => a.subjectId.Equals(subjectId.GetString())).Select(x => x.score).Where(c => c > 0)
                 };
 
                 double max = subjectScore.name.Max(s => Math.Abs(s));