Private
Public Access
1
0

added record of workout origin

This commit is contained in:
Sander Roosendaal
2017-04-27 18:12:39 +02:00
parent c7447c3fad
commit 0d04132c3c
3 changed files with 37 additions and 4 deletions

View File

@@ -381,7 +381,8 @@ def checkworkoutuser(user,workout):
# Create workout data from Strava or Concept2
# data and create the associated Workout object and save it
def add_workout_from_strokedata(user,importid,data,strokedata,
source='c2',splitdata=None):
source='c2',splitdata=None,
workoutsource='concept2'):
workouttype = data['type']
if workouttype not in [x[0] for x in Workout.workouttypes]:
workouttype = 'water'
@@ -538,7 +539,8 @@ def add_workout_from_strokedata(user,importid,data,strokedata,
workouttype=workouttype,
title=title,notes=comments,
totaldist=totaldist,
totaltime=totaltime)
totaltime=totaltime,
workoutsource=workoutsource)
@@ -697,6 +699,7 @@ def add_workout_from_runkeeperdata(user,importid,data):
id,message = dataprep.save_workout_database(csvfilename,r,
workouttype=workouttype,
workoutsource='runkeeper',
title=title,
notes=comments)
@@ -863,7 +866,8 @@ def add_workout_from_stdata(user,importid,data):
id,message = dataprep.save_workout_database(csvfilename,r,
workouttype=workouttype,
title=title,
notes=comments)
notes=comments,
workoutsource='sporttracks')
return (id,message)
@@ -1029,6 +1033,7 @@ def add_workout_from_underarmourdata(user,importid,data):
id,message = dataprep.save_workout_database(csvfilename,r,
workouttype=workouttype,
workoutsource='mapmyfitness',
title=title,
notes=comments)
@@ -5507,7 +5512,8 @@ def workout_getstravaworkout_view(request,stravaid):
strokedata = res[1]
data = res[0]
id,message = add_workout_from_strokedata(request.user,stravaid,data,strokedata,
source='strava')
source='strava',
workoutsource='strava')
try:
w = Workout.objects.get(id=id)
except Workout.DoesNotExist: