This commit is contained in:
parent
7974cd115e
commit
03901ceb06
@ -212,11 +212,14 @@ namespace YD_AllHeartRates.Api.Services.Impl
|
||||
|
||||
int total = RedisHelper.Keys("heartRate:*").Length;
|
||||
|
||||
res.WarmUp = total == 0 ? 0 : (int)Math.Round(warmUp * 100.0 / total);
|
||||
res.Low = total == 0 ? 0 : (int)Math.Round(low * 100.0 / total);
|
||||
res.Medium = total == 0 ? 0 : (int)Math.Round(medium * 100.0 / total);
|
||||
res.High = total == 0 ? 0 : (int)Math.Round(high * 100.0 / total);
|
||||
res.Warning = total == 0 ? 0 : (int)Math.Round(warning * 100.0 / total);
|
||||
int CalcPercentage(int count) =>
|
||||
total == 0 ? 0 : (int)Math.Round(count * 100.0 / total);
|
||||
|
||||
res.WarmUp = CalcPercentage(warmUp);
|
||||
res.Low = CalcPercentage(low);
|
||||
res.Medium = CalcPercentage(medium);
|
||||
res.High = CalcPercentage(high);
|
||||
res.Warning = CalcPercentage(warning);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user