workouttype mapping for C2
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
from rowers.imports import *
|
||||
import datetime
|
||||
from requests import Request, Session
|
||||
|
||||
import mytypes
|
||||
from rowers.mytypes import otwtypes
|
||||
from iso8601 import ParseError
|
||||
|
||||
@@ -428,7 +428,7 @@ def createc2workoutdata(w):
|
||||
startdate = datetime.datetime.combine(w.date,datetime.time())
|
||||
|
||||
data = {
|
||||
"type": workouttype,
|
||||
"type": mytypes.c2mapping[workouttype],
|
||||
"date": w.startdatetime.isoformat(),
|
||||
"timezone": w.timezone,
|
||||
"distance": int(w.distance),
|
||||
@@ -684,6 +684,9 @@ def process_callback(request):
|
||||
# Uploading workout
|
||||
def workout_c2_upload(user,w):
|
||||
message = 'trying C2 upload'
|
||||
if mytypes.c2mapping[w.workouttype] is None:
|
||||
return "This workout type cannot be uploaded to Concept2",0
|
||||
|
||||
thetoken = c2_open(user)
|
||||
|
||||
r = Rower.objects.get(user=user)
|
||||
@@ -755,7 +758,7 @@ def add_workout_from_data(user,importid,data,strokedata,
|
||||
source='c2',splitdata=None,
|
||||
workoutsource='concept2'):
|
||||
try:
|
||||
workouttype = data['type']
|
||||
workouttype = mytypes.c2mappinginv[data['type']]
|
||||
except KeyError:
|
||||
workouttype = 'rower'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user