Private
Public Access
1
0

Merge branch 'release/v13.44'

This commit is contained in:
Sander Roosendaal
2020-07-14 20:22:06 +02:00
3 changed files with 21 additions and 17 deletions

View File

@@ -6,6 +6,7 @@ import os
PY3K = sys.version_info >= (3, 0)
import zipfile
from zipfile import BadZipFile
import re
import time
from time import strftime
@@ -240,18 +241,21 @@ class Command(BaseCommand):
attachment.delete()
for rower in rowers:
if 'zip' in extension:
zip_file = zipfile.ZipFile(attachment.document)
for id,filename in enumerate(zip_file.namelist()):
datafile = zip_file.extract(
filename, path='media/')
if id>0:
title = name+' ('+str(id+1)+')'
else:
title = name
workoutid = processattachment(
rower, datafile, title, uploadoptions,
testing=testing
)
try:
zip_file = zipfile.ZipFile(attachment.document)
for id,filename in enumerate(zip_file.namelist()):
datafile = zip_file.extract(
filename, path='media/')
if id>0:
title = name+' ('+str(id+1)+')'
else:
title = name
workoutid = processattachment(
rower, datafile, title, uploadoptions,
testing=testing
)
except BadZipFile:
pass
else:
# move attachment and make workout
@@ -296,9 +300,9 @@ class Command(BaseCommand):
message.delete()
# Strava
rowers = Rower.objects.filter(strava_auto_import=True)
for r in rowers:
stravastuff.get_strava_workouts(r)
#rowers = Rower.objects.filter(strava_auto_import=True)
#for r in rowers:
# stravastuff.get_strava_workouts(r)
self.stdout.write(self.style.SUCCESS(
'Successfully processed email attachments'))

View File

@@ -3442,7 +3442,7 @@ class RowerExportForm(ModelForm):
'runkeeper_auto_export',
'sporttracks_auto_export',
'strava_auto_export',
'strava_auto_import',
#'strava_auto_import',
'trainingpeaks_auto_export',
]

View File

@@ -1083,7 +1083,7 @@ def strava_webhook_view(request):
return HttpResponse(status=200)
try:
ws = Workout.objects.filter(uploadedtostrava=stravaid)
if len(ws) == 0:
if ws.count() == 0:
return HttpResponse(status=200)
except Workout.DoesNotExist:
timestamp = time.strftime('%b-%d-%Y_%H%M', t)