You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
2.1 KiB
94 lines
2.1 KiB
1 year ago
|
|
||
1 year ago
|
|
||
|
WORKOUT_DATABASE = {
|
||
|
"countFinishedTraining": 0,
|
||
|
"imagePath": "defaultTraining.png",
|
||
|
"isImagePathExternal": False,
|
||
|
"name": "lol2",
|
||
|
"orderNr": -1,
|
||
|
"trainingPlanId": 0,
|
||
|
"workoutSessions": []
|
||
|
}
|
||
|
|
||
|
|
||
1 year ago
|
def create_workout_database(name, workout_sessions):
|
||
1 year ago
|
new_db = dict(WORKOUT_DATABASE)
|
||
|
new_content = {
|
||
|
"name": name,
|
||
|
"workoutSessions": workout_sessions
|
||
|
}
|
||
|
|
||
|
new_db.update(new_content)
|
||
|
return new_db
|
||
|
|
||
|
|
||
|
WORKOUT_SESSION = {
|
||
|
"finished": False,
|
||
|
"name": "1. day",
|
||
|
"orderNr": -1,
|
||
|
"trainingPlanId": 13,
|
||
|
"workoutItems": [],
|
||
|
"workoutSessionId": 0
|
||
|
}
|
||
|
|
||
|
|
||
1 year ago
|
def create_workout_session(workout_items: list):
|
||
1 year ago
|
new_session = dict(WORKOUT_SESSION)
|
||
|
new_session_content = {
|
||
1 year ago
|
'workoutItems': workout_items
|
||
1 year ago
|
}
|
||
|
new_session.update(new_session_content)
|
||
|
return new_session
|
||
|
|
||
|
|
||
|
WOPRKOUT_ITEM = {
|
||
|
"breakTime": 2,
|
||
1 year ago
|
"description": "",
|
||
1 year ago
|
"elapsedTime": 0,
|
||
|
"finished": False,
|
||
|
"imagePath": "jumping_jack.png",
|
||
|
"isImagePathExternal": False,
|
||
|
"isTimeMode": True,
|
||
|
"isVideoMode": True,
|
||
1 year ago
|
"isVideoPathExternal": True,
|
||
1 year ago
|
"name": "Jumping Jack",
|
||
|
"orderNr": -1,
|
||
|
"prepTime": 5,
|
||
|
"repetitionCount": 5,
|
||
1 year ago
|
"videoPath": "",
|
||
1 year ago
|
"workoutItemId": 0,
|
||
|
"workoutSessionId": 1,
|
||
|
"workoutTime": 30
|
||
|
}
|
||
|
|
||
|
|
||
1 year ago
|
def get_item_id():
|
||
|
start = 0
|
||
|
while True:
|
||
|
yield start
|
||
|
start += 1
|
||
|
|
||
|
|
||
|
def create_item(name, workout_time, n_repetitions, description=None, preparation_time=5, video_path=None):
|
||
|
is_video_mode = True if video_path else False
|
||
|
|
||
1 year ago
|
new_item = dict(WOPRKOUT_ITEM)
|
||
|
new_item_content = {
|
||
1 year ago
|
"name": name,
|
||
|
'description': description or '',
|
||
|
'elapsedTime': 0,
|
||
|
'imagePath': '',
|
||
|
'isImagePathExternal': False,
|
||
|
'isTimeMode': True,
|
||
|
'isVideoMode': is_video_mode,
|
||
|
'prepTime': preparation_time,
|
||
|
'repetitionCount': n_repetitions,
|
||
|
'videoPath': video_path,
|
||
|
"orderNr": next(get_item_id()),
|
||
|
"workoutItemId": 0,
|
||
|
"workoutSessionId": 1,
|
||
|
'workoutTime': workout_time
|
||
1 year ago
|
}
|
||
|
new_item.update(new_item_content)
|
||
|
return new_item
|