~cypheon/trakka

797b7393d3b146336c68417165cd767c954211a8 — Johann Rudloff 3 years ago 1e99856
Move energy expenditure rounding up, to avoid issues with `None`
1 files changed, 3 insertions(+), 3 deletions(-)

M activities/activity.py
M activities/activity.py => activities/activity.py +3 -3
@@ 217,10 217,10 @@ def analyse(track: Track, athlete_data: Mapping[str, float], raw: bool = False):

    weight = athlete_data.get('weight')
    if weight is not None:
        energy = estimate_energy(dist[-1][1],
        energy = round(estimate_energy(dist[-1][1],
                                 0, # TODO: real elevation
                                 elapsed_seconds,
                                 weight)
                                 weight))
    else:
        energy = None



@@ 235,7 235,7 @@ def analyse(track: Track, athlete_data: Mapping[str, float], raw: bool = False):
        'max_hr': max_hr,
        'min_hr': min_hr,
        'hr_zones': hr_zones,
        'energy': round(energy),
        'energy': energy,
    }
    if raw:
        result['t_dist'] = dist