From 346e0a845359214a70b208062a3fac48330b7a61 Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Mon, 26 Jan 2026 14:26:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=9D=87=E5=BF=83=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VOL.Ai/Services/AiAppService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/VOL.Ai/Services/AiAppService.cs b/VOL.Ai/Services/AiAppService.cs index e7b078a..bfdf96e 100644 --- a/VOL.Ai/Services/AiAppService.cs +++ b/VOL.Ai/Services/AiAppService.cs @@ -1865,7 +1865,10 @@ namespace VOL.Ai.Services res.PeopleNumber = $"{heartRateDataList.GroupBy(x => x.StudentNo).Count()}/{classRoomStudent.Count}"; res.PeopleNumberBySex = $"{classRoomStudent.Count(x => x.Sex == SexType.Male)}/{classRoomStudent.Count(x => x.Sex == SexType.Female)}"; - res.AvgHR = $"{(int)(heartRateDataList.Sum(x => x.Value) / heartRateDataList.Count)} 次/分"; + res.AvgHR = heartRateDataList.Count > 0 + ? $"{(int)(heartRateDataList.Sum(x => x.Value) / heartRateDataList.Count)} 次/分" + : "0 次/分"; + res.Consumption = heartRateDataList.Count > 0 ? $"{Math.Abs(heartRateDataList.Sum(x => x.Consumption ?? 0) / heartRateDataList.Count)} 千卡" : ""; //res.Density = $"{(int)(heartRateDataList.Where(x => x.Strength > 50).Sum(x => x.Strength) / heartRateDataList.Count)} %";