diff --git a/rowers/views.py b/rowers/views.py index b18410b2..d561c448 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)