better use of comments in C2 import
This commit is contained in:
@@ -201,6 +201,7 @@ def create_async_workout(alldata,user,c2id):
|
||||
verified = data['verified']
|
||||
startdatetime = iso8601.parse_date(data['date'])
|
||||
weightclass = data['weight_class']
|
||||
|
||||
weightcategory = 'hwt'
|
||||
if weightclass == "L":
|
||||
weightcategory = 'lwt'
|
||||
@@ -223,13 +224,20 @@ def create_async_workout(alldata,user,c2id):
|
||||
pytz.timezone(timezone_str)
|
||||
).strftime('%H:%M:%S')
|
||||
|
||||
try:
|
||||
notes = data['comments']
|
||||
name = notes[:40]
|
||||
except (KeyError,TypeError):
|
||||
notes = 'C2 Import Workout from {startdatetime}'.format(startdatetime=startdatetime)
|
||||
name = notes
|
||||
|
||||
r = Rower.objects.get(user=user)
|
||||
|
||||
|
||||
w = Workout(
|
||||
user=r,
|
||||
workouttype = workouttype,
|
||||
name = 'C2 Import Workout from {startdatetime}'.format(startdatetime=startdatetime),
|
||||
name = name,
|
||||
date = workoutdate,
|
||||
starttime = starttime,
|
||||
startdatetime = startdatetime,
|
||||
@@ -239,7 +247,7 @@ def create_async_workout(alldata,user,c2id):
|
||||
weightcategory = weightcategory,
|
||||
uploadedtoc2 = c2id,
|
||||
csvfilename = csvfilename,
|
||||
notes = 'imported from Concept2 log'
|
||||
notes = notes
|
||||
)
|
||||
|
||||
w.save()
|
||||
@@ -995,10 +1003,15 @@ def add_workout_from_data(user,importid,data,strokedata,
|
||||
title = ""
|
||||
try:
|
||||
t = data['comments'].split('\n', 1)[0]
|
||||
title += t[:20]
|
||||
title += t[:40]
|
||||
except:
|
||||
title = 'Imported'
|
||||
|
||||
try:
|
||||
comments = data['comments']
|
||||
except KeyError:
|
||||
comments = ''
|
||||
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp
|
||||
|
||||
res = make_cumvalues(0.1*strokedata['t'])
|
||||
|
||||
Reference in New Issue
Block a user