Private
Public Access
1
0

Merge branch 'release/v18.10.6'

This commit is contained in:
Sander Roosendaal
2023-02-19 19:42:42 +01:00
2 changed files with 10 additions and 9 deletions

View File

@@ -116,14 +116,10 @@ class NKIntegration(SyncIntegration):
before = kwargs.get('before',0)
after = kwargs.get('after',0)
# For debugging
#startdate = '2021-01-01'
#enddate = '2021-06-01'
#before = arrow.get(enddate)
#before = str(int(before.timestamp()*1000))
#after = arrow.get(startdate)
#after = str(int(after.timestamp()*1000))
if after > before:
temp = before
before = after
after = temp
r = self.rower
authorizationstring = str('Bearer ' + r.nktoken)
@@ -141,6 +137,8 @@ class NKIntegration(SyncIntegration):
res = requests.get(url, headers=headers, params=params)
if (res.status_code != 200): # pragma: no cover
dologging('nklog.log',res.status_code)
dologging('nklog.log',res.text)
raise NoTokenError("No NK Token")

View File

@@ -394,7 +394,10 @@ def workout_import_view(request, source='c2'):
ids = tdict['workoutid']
nkids = [int(id) for id in ids]
for nkid in nkids:
_ = integration.get_workout(nkid)
try:
_ = integration.get_workout(nkid, startdate=startdate, enddate=enddate)
except NoTokenError:
pass
messages.info(
request,
'Your {source} workouts will be imported in the background.'