 ## Calculated Fields

by camel

Downloads: 23,692 (9) • Reviews: 4

 Version: 1.2.9.4 Updated: Apr 11, 2011

## Time discrepancy problem

### Time discrepancy problem

Hi, I have a problem with time discrepancies in the activities, I'm trying to get elapsed times in the heart rate zones but the sum of them is bigger than the original time, example:

Activity Summary:
Time: 17:40
Stopped: 0:01

Expression used:

ELPASED_TIME_Z1 = {DATATRACK}.Where(o => o.HR >= 0 && o.HR <= 115).Count()
ELPASED_TIME_Z2 = {DATATRACK}.Where(o => o.HR > 115 && o.HR <= 141).Count()
ELPASED_TIME_Z3 = {DATATRACK}.Where(o => o.HR > 141 && o.HR <= 159).Count()
ELPASED_TIME_Z4 = {DATATRACK}.Where(o => o.HR > 159 && o.HR <= 178).Count()
ELPASED_TIME_Z5 = {DATATRACK}.Where(o => o.HR >= 178 && o.HR <= 195).Count()

Values returned:

ELPASED_TIME_Z1 = 1
ELPASED_TIME_Z2 = 19
ELPASED_TIME_Z3 = 26
ELPASED_TIME_Z4 = 725
ELPASED_TIME_Z5 = 331

ELPASED_TIME_Z1 + ELPASED_TIME_Z2 + ELPASED_TIME_Z3 + ELPASED_TIME_Z4 + ELPASED_TIME_Z5 = 1102 seconds!

I don't know why I get a bigger value, if I use {RANGEELAPSED(HR,xxx,xxx)} formulas even I get a bigger value of seconds. Can somebody help me?

Greetings.
AlexMTB

Posts: 32
Joined: Mon Sep 07, 2015 6:22 am

### Re: Time discrepancy problem

Hi,

Without the activitydata it 'll be a guess. Afterall there can be something wrong in the recorded data. But 1 thing you have to change in your formula:
ELPASED_TIME_Z4 = {DATATRACK}.Where(o => o.HR > 159 && o.HR <= 178).Count()
ELPASED_TIME_Z5 = {DATATRACK}.Where(o => o.HR >= 178 && o.HR <= 195).Count()

will count the time with hr=178 double. It probably have to be o.hr>178 instead of o.hr>=178 like the other lines.

Regards,
Dirk
dirk66
Donated! Posts: 533
Joined: Thu Feb 26, 2009 6:40 am
Location: Oss, Netherlands

### Re: Time discrepancy problem

dirk66 wrote:Hi,

It probably have to be o.hr>178 instead of o.hr>=178 like the other lines.

Regards,
Dirk

You're right, it must be o.hr>178 instead of o.hr>=178. I didn't see it!! Now the sum is proper 1060 seconds.

Thanks
AlexMTB

Posts: 32
Joined: Mon Sep 07, 2015 6:22 am