Exemplo n.º 1
0
        public async Task <List <GetRestingHeartRateMsg> > GetRestingHeartRateHistory(UsernameData hr)
        {
            List <GetRestingHeartRateMsg> list = null;

            try
            {
                list = await _heartRateRecordDao.GetRestingHeartRateHistory(hr);
            }
            catch (Exception e)
            {
                throw new CustomException("Error at get all resting heart rate data in service " + e);
            }
            return(list);
        }
Exemplo n.º 2
0
        private async Task <int> GetRestingHeartRate(UsernameData data)
        {
            List <GetRestingHeartRateMsg> list = null;

            try
            {
                list = await _heart.GetRestingHeartRateHistory(data);
            }
            catch (Exception e)
            {
                throw new CustomException("failed to get resting hr data" + e);
            }

            double sum   = 0;
            int    count = 0;

            foreach (GetRestingHeartRateMsg msg in list)
            {
                sum += msg.bpmAvg;
                ++count;
            }
            return((int)sum / count);
        }