Private
Public Access
1
0

notifications suppressed & some strava checking

This commit is contained in:
Sander Roosendaal
2018-07-12 12:39:10 +02:00
parent 1ada144b8e
commit 80623af8c5
4 changed files with 51 additions and 11 deletions

View File

@@ -99,19 +99,21 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
)
try:
if workoutid:
email_sent = send_confirm(
rower.user, title, link,
uploadoptions
)
time.sleep(10)
except:
try:
time.sleep(10)
if workoutid:
if rower.getemailnotifications and not rower.emailbounced:
email_sent = send_confirm(
rower.user, title, link,
uploadoptions
)
time.sleep(10)
except:
try:
time.sleep(10)
if workoutid:
if rower.getemailnotifications and not rower.emailbounced:
email_sent = send_confirm(
rower.user, title, link,
uploadoptions
)
except:
pass

View File

@@ -92,14 +92,33 @@ def get_strava_workouts(rower):
return 0
else:
stravaids = [int(item['id']) for item in res.json()]
stravadata = [{
'id':int(item['id']),
'elapsed_time':item['elapsed_time'],
'start_date':item['start_date'],
} for item in res.json()]
alldata = {}
for item in res.json():
alldata[item['id']] = item
wfailed = Workout.objects.filter(user=rower,uploadedtostrava=-1)
for w in wfailed:
for item in stravadata:
elapsed_time = item['elapsed_time']
start_date = item['start_date']
stravaid = item['id']
if arrow.get(start_date) == arrow.get(w.startdatetime):
if datetime.time(seconds=int(elapsed_time)) == w.duration:
w.uploadedtostrava = int(stravaid)
w.save()
knownstravaids = uniqify([
w.uploadedtostrava for w in Workout.objects.filter(user=rower)
])
newids = [stravaid for stravaid in stravaids if not stravaid in knownstravaids]

File diff suppressed because one or more lines are too long

View File

@@ -9189,6 +9189,25 @@ def workout_stravaimport_view(request,message=""):
workouts = []
r = getrower(request.user)
stravaids = [int(item['id']) for item in res.json()]
stravadata = [{
'id':int(item['id']),
'elapsed_time':item['elapsed_time'],
'start_date':item['start_date'],
} for item in res.json()]
wfailed = Workout.objects.filter(user=rower,uploadedtostrava=-1)
for w in wfailed:
for item in stravadata:
elapsed_time = item['elapsed_time']
start_date = item['start_date']
stravaid = item['id']
if arrow.get(start_date) == arrow.get(w.startdatetime):
if datetime.time(seconds=int(elapsed_time)) == w.duration:
w.uploadedtostrava = int(stravaid)
w.save()
knownstravaids = uniqify([
w.uploadedtostrava for w in Workout.objects.filter(user=r)
])