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

View File

@@ -232,6 +232,11 @@ def createrunkeeperworkoutdata(w):
distancedata.append(point) distancedata.append(point)
start_time = w.startdatetime.strftime("%a, %d %b %Y %H:%M:%S") 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: if haslatlon:
data = { data = {
@@ -239,7 +244,7 @@ def createrunkeeperworkoutdata(w):
"start_time": start_time, "start_time": start_time,
"total_distance": int(w.distance), "total_distance": int(w.distance),
"duration": duration, "duration": duration,
"notes": w.notes+'\n from '+w.workoutsource+' via rowsandall.com', "notes": newnotes,
"average_heart_rate": averagehr, "average_heart_rate": averagehr,
"path": locdata, "path": locdata,
"distance": distancedata, "distance": distancedata,
@@ -253,7 +258,7 @@ def createrunkeeperworkoutdata(w):
"start_time": start_time, "start_time": start_time,
"total_distance": int(w.distance), "total_distance": int(w.distance),
"duration": duration, "duration": duration,
"notes": w.notes+'\n from '+w.workoutsource+' via rowsandall.com', "notes": newnotes,
"avg_heartrate": averagehr, "avg_heartrate": averagehr,
"distance": distancedata, "distance": distancedata,
"heart_rate": hrdata, "heart_rate": hrdata,

View File

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

View File

@@ -228,7 +228,10 @@ def createunderarmourworkoutdata(w):
duration += w.duration.second duration += w.duration.second
duration += +1.0e-6*w.duration.microsecond duration += +1.0e-6*w.duration.microsecond
name = w.name name = w.name
notes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com' 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 # adding diff, trying to see if this is valid
#t = row.df.ix[:,'TimeStamp (sec)'].values-10*row.df.ix[0,'TimeStamp (sec)'] #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) tcxfile,tcxmessg = stravastuff.createstravaworkoutdata(w)
if tcxfile: if tcxfile:
with open(tcxfile,'rb') as f: 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, res,mes = stravastuff.handle_stravaexport(f,w.name,
r.stravatoken, r.stravatoken,
description=w.notes+'\n from '+w.workoutsource+' via rowsandall.com') description=newnotes)
if res==0: if res==0:
messages.error(request,mes) messages.error(request,mes)
w.uploadedtostrava = -1 w.uploadedtostrava = -1