Private
Public Access
1
0

added boattype and workouttype to YAML workout commands

This commit is contained in:
Sander Roosendaal
2018-03-25 17:52:02 +02:00
parent a9345a66b5
commit 15dbbef449

View File

@@ -181,6 +181,33 @@ def getplotoptions(uploadoptions,value):
return uploadoptions
from types import workouttypes,boattypes
def gettype(uploadoptions,value,key):
workouttype = 'rower'
for type,verb in workouttypes:
if value == type:
workouttype = type
if value == verb:
workouttype = type
uploadoptions[key] = workouttype
return uploadoptions
def getboattype(uploadoptions,value,key):
boattype = '1x'
for type,verb in boattypes:
if value == type:
boattype = type
if value == verb:
boattype = type
uploadoptions[key] = boattype
return uploadoptions
def getboolean(uploadoptions,value,key):
b = True
if not value:
@@ -208,6 +235,10 @@ def upload_options(body):
uploadoptions = getplotoptions(uploadoptions,value)
if 'priva' in lowkey:
uploadoptions = getboolean(uploadoptions,value,'makeprivate')
if 'type' in lowkey:
uploadoptions = gettype(uploadoptions,value,'workouttype')
if 'boat' in lowkey:
uploadoptions = getboattype(uploadoptions,value,'workouttype')
except AttributeError:
#pass
raise yaml.YAMLError