From 19d0d5485946c21f27927e143b61483ea93d8d80 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sun, 15 Dec 2024 13:27:04 +0100 Subject: [PATCH] fixing error --- rowers/integrations/intervals.py | 36 ++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/rowers/integrations/intervals.py b/rowers/integrations/intervals.py index 7db883ae..e0692a57 100644 --- a/rowers/integrations/intervals.py +++ b/rowers/integrations/intervals.py @@ -242,25 +242,29 @@ class IntervalsIntegration(SyncIntegration): workouts = [] for item in data: - i = item['id'] - r = item['type'] - d = item['distance'] - ttot = seconds_to_duration(item['moving_time']) - s = item['start_date'] - s2 = '' - c = item['name'] - if i in known_interval_ids: - nnn = '' - else: - nnn = 'NEW' + try: + i = item['id'] + r = item['type'] + d = item['distance'] + ttot = seconds_to_duration(item['moving_time']) + s = item['start_date'] + s2 = '' + c = item['name'] + if i in known_interval_ids: + nnn = '' + else: + nnn = 'NEW' - keys = ['id','distance','duration','starttime', - 'rowtype','source','name','new'] + keys = ['id','distance','duration','starttime', + 'rowtype','source','name','new'] - values = [i, d, ttot, s, r, s2, c, nnn] + values = [i, d, ttot, s, r, s2, c, nnn] + + ress = dict(zip(keys, values)) + workouts.append(ress) + except KeyError: + dologging('intervals.icu.log', item) - ress = dict(zip(keys, values)) - workouts.append(ress) return workouts