diff --git a/rowers/dataprep.py b/rowers/dataprep.py index 0b16e99f..15e76a0c 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -483,7 +483,7 @@ def new_workout_from_file(r,f2, dosummary=dosummary, title=title) - return (id,message) + return (id,message,f2) # Compare the data from the CSV file and the database # Currently only calculates number of strokes. To be expanded with diff --git a/rowers/views.py b/rowers/views.py index b18410b2..9731e9e9 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -685,12 +685,20 @@ def workout_tcxemail_view(request,id=0): if (checkworkoutuser(request.user,w)): try: tcxfile = stravastuff.createstravaworkoutdata(w) - if settings.DEBUG: + if tcxfile == 0: + message = "Something went wrong (TCX export)" + url = reverse(workout_export_view, + kwargs = { + 'id':str(w.id), + 'message':message, + }) + return HttpResponseRedirect(url) + if settings.DEBUG and tcxfile: res = handle_sendemailtcx.delay(r.user.first_name, r.user.last_name, r.user.email,tcxfile) - else: + elif tcxfile: res = queuehigh.enqueue(handle_sendemailtcx,r.user.first_name, r.user.last_name, r.user.email,tcxfile) @@ -4233,7 +4241,7 @@ def workout_upload_view(request,message="", f2 = res[1] # file name incl media directory - id,message = dataprep.new_workout_from_file(r,f2, + id,message,f2 = dataprep.new_workout_from_file(r,f2, workouttype=workouttype, makeprivate=makeprivate, title = t, diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index 6f61935d..81a166df 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -269,6 +269,7 @@ EMAIL_USE_TLS = CFG['email_use_tls'] #EMAIL_USE_TLS = False DEFAULT_FROM_EMAIL = 'admin@rowsandall.com' + # weather stuff FORECAST_IO_KEY = CFG['forecast_io_key']