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.

99 lines
2.2 KiB

WORKOUT_DATABASE = {
"countFinishedTraining": 0,
"imagePath": "defaultTraining.png",
"isImagePathExternal": False,
"name": "lol2",
"orderNr": -1,
"trainingPlanId": 0,
"workoutSessions": []
}
def create_workout_database(name, workout_sessions):
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
}
def create_workout_session(workout_items: list):
new_session = dict(WORKOUT_SESSION)
new_session_content = {
'workoutItems': workout_items
}
new_session.update(new_session_content)
return new_session
WOPRKOUT_ITEM = {
"breakTime": 2,
"description": "",
"elapsedTime": 0,
"finished": False,
"imagePath": "jumping_jack.png",
"isImagePathExternal": False,
"isTimeMode": True,
"isVideoMode": True,
"isVideoPathExternal": True,
"name": "Jumping Jack",
"orderNr": -1,
"prepTime": 5,
"repetitionCount": 5,
"videoPath": "",
"workoutItemId": 0,
"workoutSessionId": 1,
"workoutTime": 30
}
def get_item_id():
start = 0
while True:
yield start
start += 1
def create_item(
name, workout_time=30, n_repetitions=None, description=None,
preparation_time=5, video_path=None, break_time=5
):
is_video_mode = True if video_path else False
is_time_mode = False if n_repetitions else True
new_item = dict(WOPRKOUT_ITEM)
new_item_content = {
"name": name,
'description': description or '',
'elapsedTime': 0,
'imagePath': '',
'isImagePathExternal': False,
'isTimeMode': is_time_mode,
'isVideoMode': is_video_mode,
'prepTime': preparation_time,
'repetitionCount': n_repetitions,
'videoPath': video_path,
"orderNr": next(get_item_id()),
"workoutItemId": 0,
"breakTime": break_time,
"workoutSessionId": 1,
'workoutTime': workout_time
}
new_item.update(new_item_content)
return new_item