From 969077fe22c02e0728c265167fcad90dcf1cf82f Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 22 May 2017 20:13:17 +0200 Subject: [PATCH] fixed strava export bug --- rowers/stravastuff.py | 7 ++++++- rowers/tpstuff.py | 14 ++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/rowers/stravastuff.py b/rowers/stravastuff.py index b8067b9f..83f860e1 100644 --- a/rowers/stravastuff.py +++ b/rowers/stravastuff.py @@ -250,7 +250,12 @@ def createstravaworkoutdata(w): row = rowingdata(filename) tcxfilename = filename[:-4]+'.tcx' - row.exporttotcx(tcxfilename,notes=w.notes+'\n from '+w.workoutsource+' via rowsandall.com') + try: + newnotes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com' + except TypeError: + newnotes = 'from '+w.workoutsource+' via rowsandall.com' + + row.exporttotcx(tcxfilename,notes=newnotes) gzfilename = tcxfilename+'.gz' with file(tcxfilename,'rb') as inF: s = inF.read() diff --git a/rowers/tpstuff.py b/rowers/tpstuff.py index 2a3a84c3..d27d94c5 100644 --- a/rowers/tpstuff.py +++ b/rowers/tpstuff.py @@ -218,16 +218,18 @@ def getidfromresponse(response): def createtpworkoutdata(w): filename = w.csvfilename + row = rowingdata(filename) + tcxfilename = filename[:-4]+'.tcx' try: - row = rowingdata(filename) - tcxfilename = filename[:-4]+'.tcx' - row.exporttotcx(tcxfilename,notes=w.notes+'\n from '+w.workoutsource+' via rowsandall.com') - return tcxfilename - except: - tcxfilename = 0 + newnotes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com' + except TypeError: + newnotes = 'from '+w.workoutsource+' via rowsandall.com' + row.exporttotcx(tcxfilename,notes=newnotes) + return tcxfilename + def tp_check(access_token): headers = { "Content-Type": "application/json",