コード例 #1
0
 def delete_form_childs_task_id(cls, task_id):
     try:
         tasks = TaskFunctions.get_all_task()
         for delete_task in tasks:
             is_task_child = HelpMethods.find_sub_sting_in_string(
                 delete_task.under_task_id, task_id)
             if is_task_child:
                 new_under_task_id = HelpMethods.delete_sub_string_in_string(
                     delete_task.under_task_id, task_id)
                 if new_under_task_id == '':
                     task = Task(id=delete_task.id,
                                 under_task_id='None',
                                 is_parent_task='None',
                                 expert='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,
                                 header=None,
                                 is_under_task=None,
                                 owner=None,
                                 parent_task_id=None,
                                 status=None,
                                 tags=None,
                                 time_of_start=None,
                                 is_linked=None,
                                 linked_task_id=None)
                     TaskFunctions.actions_child(task)
                 else:
                     task = Task(id=delete_task.id,
                                 under_task_id=new_under_task_id,
                                 is_parent_task='Yes',
                                 comment=None,
                                 date_of_create=None,
                                 priority=None,
                                 date_of_end=None,
                                 date_of_start=None,
                                 time_of_create=None,
                                 time_of_end=None,
                                 header=None,
                                 is_under_task=None,
                                 owner=None,
                                 parent_task_id=None,
                                 status=None,
                                 tags=None,
                                 time_of_start=None,
                                 is_linked=None,
                                 linked_task_id=None,
                                 expert=None)
                     TaskFunctions.actions_child(task)
     except:
         pass
コード例 #2
0
 def delete_link_between_task(cls, login, password, id, parent_id):
     "Yes"
     is_valid_user = UsersFunctions.get_user_by_login_and_password(
         login, password)
     is_child_has_parent_task = HelpMethods.check_under_task_and_parent_task_linked(
         id, parent_id)
     parent_task = TaskFunctions.get_task_by_id(parent_id)
     child_task = TaskFunctions.get_task_by_id(id)
     new_str_of_id_for_parent_task = HelpMethods.delete_sub_string_in_string(
         parent_task.under_task_id, id)
     if parent_task is None or child_task is None:
         print("Одной из задач не существует")
     if is_valid_user is None:
         print("Пароль или логин введен неверно")
     if parent_task.owner != login or child_task.owner != login:
         print("Вы не являетесь создателем данных задач")
     if parent_task.is_parent_task == "Yes":
         print("Родительская задача уже является родителем")
     elif is_child_has_parent_task is False:
         print("У подзадачи нет родителя")
     else:
         new_child_task = Task(id=id,
                               parent_task_id=0,
                               is_under_task='None',
                               expert='None',
                               comment=None,
                               date_of_create=None,
                               time_of_create=None,
                               priority=None,
                               header=None,
                               owner=None,
                               tags=None,
                               status=None,
                               is_parent_task=None,
                               under_task_id=None,
                               time_of_start=None,
                               is_linked=None,
                               linked_task_id=None,
                               date_of_end=None,
                               date_of_start=None,
                               time_of_end=None)
         TaskFunctions.actions_child(new_child_task)
         if new_str_of_id_for_parent_task == '':
             new_parent_task = Task(id=parent_id,
                                    is_parent_task='None',
                                    under_task_id='None',
                                    comment=None,
                                    date_of_create=None,
                                    time_of_create=None,
                                    priority=None,
                                    header=None,
                                    owner=None,
                                    parent_task_id=None,
                                    tags=None,
                                    status=None,
                                    expert=None,
                                    is_under_task=None,
                                    time_of_start=None,
                                    is_linked=None,
                                    linked_task_id=None,
                                    date_of_end=None,
                                    date_of_start=None,
                                    time_of_end=None)
             TaskFunctions.actions_parent(new_parent_task)
         else:
             new_parent_task = Task(
                 id=parent_id,
                 is_parent_task='Yes',
                 under_task_id=new_str_of_id_for_parent_task,
                 comment=None,
                 date_of_create=None,
                 time_of_create=None,
                 priority=None,
                 header=None,
                 owner=None,
                 parent_task_id=None,
                 tags=None,
                 status=None,
                 expert=None,
                 is_under_task=None,
                 time_of_start=None,
                 is_linked=None,
                 linked_task_id=None,
                 date_of_end=None,
                 date_of_start=None,
                 time_of_end=None)
             TaskFunctions.actions_parent(new_parent_task)
コード例 #3
0
 def add_parent_for_task(cls, login, password, id, parent_id, expert):
     "Yes"
     is_valid_user = UsersFunctions.get_user_by_login_and_password(
         login, password)
     is_child_has_parent_task = HelpMethods.is_task_have_parent(id)
     parent_task = TaskFunctions.get_task_by_id(parent_id)
     child_task = TaskFunctions.get_task_by_id(id)
     is_tasks_already_linked = HelpMethods.check_under_task_and_parent_task_linked(
         parent_id, id)
     if is_valid_user is None:
         print("Пароль или логин введен неверно")
         return "Пароль или логин введен неверно"
     if parent_task.owner != login or child_task.owner != login:
         print("Вы не являетесь создателем данных задач")
         return "Вы не являетесь создателем данных задач"
     if parent_task.is_parent_task == "Yes":
         print("Родительская задача уже является родителем")
         return "Родительская задача уже является родителем"
     if id == parent_id:
         print("Вы не можете пометить задаче как родительскую саму себя")
         return "Вы не можете пометить задаче как родительскую саму себя"
     if is_child_has_parent_task:
         print("У данной задачи уже есть родитель")
         return "У данной задачи уже есть родитель"
     if is_tasks_already_linked:
         print("Данные задачи уже связаны")
         return "Данные задачи уже связаны"
     if parent_task is None or child_task is None:
         print("Одной из задач не существует")
         return "Одной из задач не существует"
     else:
         if parent_task.under_task_id == 'None' and parent_task.is_parent_task == 'None':
             new_parent_task = Task(id=parent_id,
                                    under_task_id=str(id) + ',',
                                    is_parent_task='Yes',
                                    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,
                                    time_of_start=None,
                                    is_linked=None,
                                    linked_task_id=None,
                                    date_of_end=None,
                                    date_of_start=None,
                                    time_of_end=None)
             TaskFunctions.actions_parent(new_parent_task)
             new_child_task = Task(id=id,
                                   parent_task_id=parent_id,
                                   is_under_task='Yes',
                                   expert=expert,
                                   comment=None,
                                   date_of_create=None,
                                   time_of_create=None,
                                   priority=None,
                                   header=None,
                                   owner=None,
                                   tags=None,
                                   status=None,
                                   is_parent_task=None,
                                   under_task_id=None,
                                   time_of_start=None,
                                   is_linked=None,
                                   linked_task_id=None,
                                   date_of_end=None,
                                   date_of_start=None,
                                   time_of_end=None)
             TaskFunctions.actions_child(new_child_task)
         else:
             new_parent_task = Task(
                 id=parent_id,
                 under_task_id=parent_task.under_task_id + str(id) + ',',
                 is_parent_task='Yes',
                 expert=expert,
                 comment=None,
                 date_of_create=None,
                 time_of_create=None,
                 priority=None,
                 header=None,
                 owner=None,
                 tags=None,
                 status=None,
                 is_under_task=None,
                 parent_task_id=None,
                 time_of_start=None,
                 is_linked=None,
                 linked_task_id=None,
                 date_of_end=None,
                 date_of_start=None,
                 time_of_end=None)
             TaskFunctions.actions_parent(new_parent_task)
             new_child_task = Task(id=id,
                                   parent_task_id=int(id),
                                   is_under_task='Yes',
                                   expert=str(expert),
                                   comment=None,
                                   date_of_create=None,
                                   time_of_create=None,
                                   priority=None,
                                   header=None,
                                   owner=None,
                                   tags=None,
                                   status=None,
                                   is_parent_task=None,
                                   under_task_id=None,
                                   time_of_start=None,
                                   is_linked=None,
                                   linked_task_id=None,
                                   date_of_end=None,
                                   date_of_start=None,
                                   time_of_end=None)
             TaskFunctions.actions_child(new_child_task)