def parse_and_delete_id_from_linked_task(cls, linked_task_id, deleted_id): try: old_task = TaskFunctions.get_task_by_id(linked_task_id) new_linked_id_string = HelpMethods.delete_sub_string_in_string( old_task.linked_task_id, deleted_id) if new_linked_id_string == '': task = Task(id=linked_task_id, is_linked='None', linked_task_id='None', comment=None, date_of_create=None, priority=None, date_of_end=None, date_of_start=None, time_of_create=None, time_of_end=None, expert=None, header=None, is_parent_task=None, is_under_task=None, owner=None, parent_task_id=None, status=None, tags=None, time_of_start=None, under_task_id=None) TaskFunctions.actions_linked(task) else: task = Task(id=linked_task_id, is_linked='Yes', linked_task_id=new_linked_id_string, comment=None, date_of_create=None, priority=None, date_of_end=None, date_of_start=None, time_of_create=None, time_of_end=None, expert=None, header=None, is_parent_task=None, is_under_task=None, owner=None, parent_task_id=None, status=None, tags=None, time_of_start=None, under_task_id=None) TaskFunctions.actions_linked(task) except: pass
def delete_link_between_linked_task(cls, login, password, id, linked_task_id): "Yes" is_valid_user = UsersFunctions.get_user_by_login_and_password( login, password) left_task = TaskFunctions.get_task_by_id(id) right_task = TaskFunctions.get_task_by_id(linked_task_id) is_task_already_linked = HelpMethods.is_tasks_already_linked( id, linked_task_id) new_linked_str_for_left_task = HelpMethods.delete_sub_string_in_string( left_task.linked_task_id, linked_task_id) new_linked_str_for_right_task = HelpMethods.delete_sub_string_in_string( right_task.linked_task_id, id) if is_valid_user is None: print("Пароль или логин введен неверно") elif left_task is None: print("Данной задачи не существует") elif right_task is False: print("Задачи, с которой вы пытаетесь связать, не существует") elif right_task.owner != login or left_task.owner != login: print("Вы не являетесь владельцем данных задач") elif id == linked_task_id: print("Вы не можете связать задачу с самой сабой") elif is_task_already_linked is not True: print("Задачи не связаны") else: if new_linked_str_for_left_task == '': new_task = Task(id=left_task.id, is_linked='None', linked_task_id='None', comment=None, date_of_create=None, time_of_create=None, expert=None, priority=None, header=None, is_under_task=None, owner=None, parent_task_id=None, tags=None, status=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.actions_linked(new_task) else: new_task = Task(id=left_task.id, is_linked='Yes', linked_task_id=new_linked_str_for_left_task, comment=None, date_of_create=None, time_of_create=None, expert=None, priority=None, header=None, is_under_task=None, owner=None, parent_task_id=None, tags=None, status=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.actions_linked(new_task) if new_linked_str_for_right_task == '': new_task = Task(id=right_task.id, is_linked='None', linked_task_id='None', comment=None, date_of_create=None, time_of_create=None, expert=None, priority=None, header=None, is_under_task=None, owner=None, parent_task_id=None, tags=None, status=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.actions_linked(new_task) else: new_task = Task(id=right_task.id, is_linked='Yes', linked_task_id=new_linked_str_for_right_task, comment=None, date_of_create=None, time_of_create=None, expert=None, priority=None, header=None, is_under_task=None, owner=None, parent_task_id=None, tags=None, status=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.actions_linked(new_task)