intervals auto im & export
This commit is contained in:
@@ -183,6 +183,7 @@ class IntervalsIntegration(SyncIntegration):
|
||||
|
||||
thetype = mytypes.intervalsmapping[workout.workouttype]
|
||||
response = requests.put(url, headers=headers, json={'type': thetype})
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
return 0
|
||||
|
||||
@@ -260,8 +261,31 @@ class IntervalsIntegration(SyncIntegration):
|
||||
self.rower.intervals_token,
|
||||
id)
|
||||
|
||||
def get_workouts(workout, *args, **kwargs) -> list:
|
||||
return NotImplemented
|
||||
return 1
|
||||
|
||||
def get_workouts(self, *args, **kwargs):
|
||||
startdate = timezone.now() - timedelta(days=7)
|
||||
enddate = timezone.now() + timedelta(days=1)
|
||||
startdatestring = kwargs.get(startdate,"")
|
||||
enddatestring = kwargs.get(enddate,"")
|
||||
|
||||
try:
|
||||
startdate = arrow.get(startdatestring).datetime
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
enddate = arrow.get(enddatestring).datetime
|
||||
except:
|
||||
pass
|
||||
|
||||
count = 0
|
||||
workouts = self.get_workout_list(startdate=startdate, enddate=enddate)
|
||||
for workout in workouts:
|
||||
if workout['new'] == 'NEW':
|
||||
self.get_workout(workout['id'])
|
||||
count +=1
|
||||
|
||||
return count
|
||||
|
||||
def make_authorization_url(self, *args, **kwargs):
|
||||
return super(IntervalsIntegration, self).make_authorization_url(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user