f
This commit is contained in:
parent
11281808e5
commit
0475e15a43
@ -2046,8 +2046,8 @@ namespace VOL.Business.Services.Training
|
|||||||
|
|
||||||
var heartRateDataList = await query.ToListAsync();
|
var heartRateDataList = await query.ToListAsync();
|
||||||
|
|
||||||
if (heartRateDataList.Count == 0)
|
//if (heartRateDataList.Count == 0)
|
||||||
return res;
|
// return res;
|
||||||
|
|
||||||
var classRoom = await _teacherRepository.DbContext.Set<Ai_ClassRoomRecord>().Include(x => x.ClassroomStudentRecord)
|
var classRoom = await _teacherRepository.DbContext.Set<Ai_ClassRoomRecord>().Include(x => x.ClassroomStudentRecord)
|
||||||
.Where(x => x.SchoolCode == schoolCode && x.Id == id)
|
.Where(x => x.SchoolCode == schoolCode && x.Id == id)
|
||||||
@ -2064,7 +2064,7 @@ namespace VOL.Business.Services.Training
|
|||||||
res.PeopleNumberBySex = $"{classRoomStudent.Count(x => x.Sex == SexType.Male)}/{classRoomStudent.Count(x => x.Sex == SexType.Female)}";
|
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 = $"{(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)(heartRateDataList.Where(x => x.Strength > 50).Sum(x => x.Strength) / heartRateDataList.Count)} %";
|
||||||
|
|
||||||
res.Density = $"{(int)CalculatePercentage(heartRateDataList.Count(x => x.Strength > 50), heartRateDataList.Count)} %";
|
res.Density = $"{(int)CalculatePercentage(heartRateDataList.Count(x => x.Strength > 50), heartRateDataList.Count)} %";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user