报告
This commit is contained in:
parent
f75741c1bc
commit
a8337cd8c0
@ -2067,12 +2067,17 @@ namespace VOL.Business.Services.Training
|
||||
|
||||
var heartRateDataList = await query.ToListAsync();
|
||||
|
||||
if (heartRateDataList.Count == 0)
|
||||
return res;
|
||||
//if (heartRateDataList.Count == 0)
|
||||
// return res;
|
||||
|
||||
var classRoom = await _teacherRepository.DbContext.Set<Ai_ClassRoomRecord>().Include(x => x.ClassroomStudentRecord)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstAsync();
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (classRoom == null)
|
||||
{
|
||||
throw new Exception("未找到对应的班级记录");
|
||||
}
|
||||
|
||||
var classRoomStudent = await _teacherRepository.DbContext.Set<Ai_ClassroomStudentRecord>()
|
||||
.Where(x => x.ClassRoomRecordId == id)
|
||||
@ -2084,8 +2089,9 @@ namespace VOL.Business.Services.Training
|
||||
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.Consumption = $"{Math.Abs(heartRateDataList.Sum(x => x.Consumption ?? 0) / 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)} %";
|
||||
|
||||
res.Density = $"{(int)Tool.CalculatePercentage(heartRateDataList.Count(x => x.Strength > 50), heartRateDataList.Count)} %";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user