Private
Public Access
1
0

correction for None notes everywhere

This commit is contained in:
Sander Roosendaal
2017-05-22 20:42:45 +02:00
parent dd43805c08
commit b0e7ab2cb9
5 changed files with 22 additions and 6 deletions

View File

@@ -242,6 +242,10 @@ def createc2workoutdata_as_splits(w):
except ValueError:
durationstr = datetime.strptime(str(w.duration),"%H:%M:%S")
try:
newnotes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com'
except TypeError:
newnotes = 'from '+w.workoutsource+' via rowsandall.com'
data = {
"type": w.workouttype,
@@ -250,7 +254,7 @@ def createc2workoutdata_as_splits(w):
"time": int(10*makeseconds(durationstr)),
"timezone": "Etc/UTC",
"weight_class": c2wc(w.weightcategory),
"comments": w.notes+'\n from '+w.workoutsource+' via rowsandall.com',
"comments": newnotes,
"heart_rate": {
"average": averagehr,
"max": maxhr,

View File

@@ -233,13 +233,18 @@ def createrunkeeperworkoutdata(w):
start_time = w.startdatetime.strftime("%a, %d %b %Y %H:%M:%S")
try:
newnotes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com'
except TypeError:
newnotes = 'from '+w.workoutsource+' via rowsandall.com'
if haslatlon:
data = {
"type": "Rowing",
"start_time": start_time,
"total_distance": int(w.distance),
"duration": duration,
"notes": w.notes+'\n from '+w.workoutsource+' via rowsandall.com',
"notes": newnotes,
"average_heart_rate": averagehr,
"path": locdata,
"distance": distancedata,
@@ -253,7 +258,7 @@ def createrunkeeperworkoutdata(w):
"start_time": start_time,
"total_distance": int(w.distance),
"duration": duration,
"notes": w.notes+'\n from '+w.workoutsource+' via rowsandall.com',
"notes": newnotes,
"avg_heartrate": averagehr,
"distance": distancedata,
"heart_rate": hrdata,

View File

@@ -281,7 +281,7 @@ def createsporttracksworkoutdata(w):
try:
w.notes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com',
except TypeError:
w.notes = w.notes+' via rowsandall.com'
w.notes = 'from '+w.workoutsource+' via rowsandall.com'
if haslatlon:
data = {

View File

@@ -228,7 +228,10 @@ def createunderarmourworkoutdata(w):
duration += w.duration.second
duration += +1.0e-6*w.duration.microsecond
name = w.name
try:
notes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com'
except TypeError:
notes = 'from '+w.workoutsource+' via rowsandall.com'
# adding diff, trying to see if this is valid
#t = row.df.ix[:,'TimeStamp (sec)'].values-10*row.df.ix[0,'TimeStamp (sec)']

View File

@@ -1266,9 +1266,13 @@ def workout_strava_upload_view(request,id=0):
tcxfile,tcxmessg = stravastuff.createstravaworkoutdata(w)
if tcxfile:
with open(tcxfile,'rb') as f:
try:
newnotes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com'
except TypeError:
newnotes = 'from '+w.workoutsource+' via rowsandall.com'
res,mes = stravastuff.handle_stravaexport(f,w.name,
r.stravatoken,
description=w.notes+'\n from '+w.workoutsource+' via rowsandall.com')
description=newnotes)
if res==0:
messages.error(request,mes)
w.uploadedtostrava = -1