notifications suppressed & some strava checking
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
|
||||
2
rowers/testdata/stravaworkoutlist.txt
vendored
2
rowers/testdata/stravaworkoutlist.txt
vendored
File diff suppressed because one or more lines are too long
@@ -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)
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user