diff --git a/VOL.Ai/Services/AiAppService.cs b/VOL.Ai/Services/AiAppService.cs index dd8c445..97c52d3 100644 --- a/VOL.Ai/Services/AiAppService.cs +++ b/VOL.Ai/Services/AiAppService.cs @@ -1490,8 +1490,8 @@ namespace VOL.Ai.Services var heartRateDataList = await query.ToListAsync(); - if (heartRateDataList.Count == 0) - return res; + //if (heartRateDataList.Count == 0) + // return res; var classRoom = await _teacherRepository.DbContext.Set().Include(x => x.ClassroomStudentRecord) .Where(x => x.SchoolCode == paramDto.SchoolCode && x.Id == paramDto.ClassRoomRecordId) @@ -1528,7 +1528,7 @@ namespace VOL.Ai.Services 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.Consumption = $"{Math.Abs(heartRateDataList.Sum(x => x.Consumption ?? 0) / heartRateDataList.Count)} 千卡"; + 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)} %"; res.Density = $"{(int)Tool.CalculatePercentage(heartRateDataList.Count(x => x.Strength > 50), heartRateDataList.Count)} %"; diff --git a/VOL.WebApi/Program.cs b/VOL.WebApi/Program.cs index c08183a..7baa15c 100644 --- a/VOL.WebApi/Program.cs +++ b/VOL.WebApi/Program.cs @@ -50,7 +50,7 @@ namespace VOL.WebApi serverOptions.Limits.MaxRequestLineSize = 81920; // 8 KB // Set properties and call methods on options }); - webBuilder.UseKestrel().UseUrls("http://*:9992"); + webBuilder.UseKestrel().UseUrls("http://*:9993"); webBuilder.UseIIS(); webBuilder.UseStartup(); }).UseServiceProviderFactory(new AutofacServiceProviderFactory());