Private
Public Access
1
0

fixing links in tasks

This commit is contained in:
Sander Roosendaal
2022-08-19 09:08:46 +02:00
parent ec3c3c0b9a
commit 0a83a26044
4 changed files with 48 additions and 87 deletions

View File

@@ -56,7 +56,7 @@ def workout_tp_upload_view(request, id=0):
check_tp_workout_id,
w,
headers['Location'])
messages.info(request, 'Uploaded to TrainingPeaks')
else: # pragma: no cover # no tcxfile
@@ -1316,11 +1316,7 @@ def strava_webhook_view(request):
# logging
t = time.localtime()
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
with open('strava_webhooks.log', 'a') as f:
f.write('\n')
f.write(timestamp)
f.write(' ')
f.write(str(request.body))
dologging("strava_webhooks.log",request.body)
# POST - does nothing so far
data = json.loads(request.body)
@@ -1331,11 +1327,7 @@ def strava_webhook_view(request):
_ = data['event_time']
except KeyError: # pragma: no cover
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
with open('strava_webhooks.log', 'a') as f:
f.write('\n')
f.write(timestamp)
f.write(' ')
f.write('KeyError line 1038')
dologging("strava_webhooks.log","KeyError line 1330")
return HttpResponse(status=200)
if object_type == 'activity':
@@ -1396,11 +1388,7 @@ def strava_webhook_view(request):
updates = data['updates']
stravaid = data['object_id']
except KeyError: # pragma: no cover
with open('strava_webhooks.log', 'a') as f:
f.write('\n')
f.write(timestamp)
f.write(' ')
f.write('KeyError line 10576')
dologging("strava_webhooks.log","KeyError line 1391")
return HttpResponse(status=200)
try:
ws = Workout.objects.filter(uploadedtostrava=stravaid)
@@ -1408,21 +1396,14 @@ def strava_webhook_view(request):
return HttpResponse(status=200)
except Workout.DoesNotExist: # pragma: no cover
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
with open('strava_webhooks.log', 'a') as f:
f.write('\n')
f.write(timestamp)
f.write(' ')
f.write('Workout not found')
dologging("strava_webhooks.log","workout not found")
return HttpResponse(status=200)
try:
r = Rower.objects.get(strava_owner_id=strava_owner)
except Rower.DoesNotExist: # pragma: no cover
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
with open('strava_webhooks.log', 'a') as f:
f.write('\n')
f.write(timestamp)
f.write(' ')
f.write('Rower not found')
dologging("strava_webhooks.log","Rower not found")
return HttpResponse(status=200)
except MultipleObjectsReturned: # pragma: no cover
rs = Rower.objects.filter(strava_owner_id=strava_owner)
@@ -1438,11 +1419,7 @@ def strava_webhook_view(request):
w.workouttype = mytypes.stravamappinginv[value]
w.save()
except KeyError: # pragma: no cover
with open('strava_webhooks.log', 'a') as f:
f.write('\n')
f.write(timestamp)
f.write(' ')
f.write('Workout type not found: '+str(value))
dologging("strava_webhooks.log","Workout type not found")
return HttpResponse(status=200)
return HttpResponse(status=200)
@@ -1457,12 +1434,7 @@ def garmin_summaries_view(request): # pragma: no cover
t = time.localtime()
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
with open('garminlog.log', 'a') as f:
f.write('\n')
f.write(timestamp)
f.write(' ')
f.write(str(request.body))
f.write('\n')
dologging("garminlog.log",request.body)
# POST request
data = json.loads(request.body)
activities = data['activities']