def change_status_of_childs_tasks(cls, id): try: all_tasks = TaskFunctions.get_all_task() for task in all_tasks: if task.parent_task_id == id: update_task = Task(id=task.id, status="Выполнено", comment=None, date_of_create=None, priority=None, time_of_create=None, header=None, is_under_task=None, owner=None, parent_task_id=None, tags=None, is_linked=None, linked_task_id=None, expert=None, is_parent_task=None, under_task_id=None, time_of_start=None, date_of_end=None, date_of_start=None, time_of_end=None) TaskFunctions.change_task_status(update_task) except: pass
def change_status(cls, login, password, id, status): "Yes" user = UsersFunctions.get_user_by_login_and_password(login, password) task = TaskFunctions.get_task_by_id(id) if user is None: print("Пароль или логин введен неверно") elif task is None: print("Данной задачи не существует") elif task.owner != login: print("Вы не являетесь создателем данной задачи") else: task = Task(id=id, status=status, comment=None, date_of_create=None, priority=None, time_of_create=None, header=None, is_under_task=None, owner=None, parent_task_id=None, tags=None, is_linked=None, linked_task_id=None, expert=None, is_parent_task=None, under_task_id=None, time_of_start=None, date_of_end=None, date_of_start=None, time_of_end=None) TaskFunctions.change_task_status(task) if status == 'Выполнено': TaskChangeMethods.change_status_of_childs_tasks(id) TaskChangeMethods.change_parent_task(id)
def change_parent_task(cls, id): try: child_task = TaskFunctions.get_task_by_id(id) parent_task = TaskFunctions.get_task_by_id( child_task.parent_task_id) child_id_of_parent_task = TaskChangeMethods.split_string( parent_task.under_task_id) count_of_complete_task = TaskFunctions.count_of_complite_task( parent_task.id) if len(child_id_of_parent_task) == count_of_complete_task: new_tasks = Task(id=parent_task.id, status='Выполнено', comment=None, date_of_create=None, priority=None, time_of_create=None, header=None, is_under_task=None, owner=None, parent_task_id=None, tags=None, is_linked=None, linked_task_id=None, expert=None, is_parent_task=None, under_task_id=None, time_of_start=None, date_of_end=None, date_of_start=None, time_of_end=None) TaskFunctions.change_task_status(new_tasks) else: new_tasks = Task(id=parent_task.id, status='В процессе выполнения', comment=None, date_of_create=None, priority=None, time_of_create=None, header=None, is_under_task=None, owner=None, parent_task_id=None, tags=None, is_linked=None, linked_task_id=None, expert=None, is_parent_task=None, under_task_id=None, time_of_start=None, date_of_end=None, date_of_start=None, time_of_end=None) TaskFunctions.change_task_status(new_tasks) except: pass