Ejemplo n.º 1
0
def pull_from_teamwork():
    List.clear_task_list()
    TaskObjectBuilder.build_list(
        TaskObjectBuilder.get_from_teamwork(T.tasks, T.tasks_name))
    tsks = List.task_list
    for task in tsks:
        if not DatabaseChecker.does_task_exist_in_db(task):
            if not DatabaseChecker.does_placed_task_exist_in_db(task):
                task.save_to_db()
        elif DatabaseChecker.has_task_been_updated(task):
            # write an update method
            task.update_in_db()
Ejemplo n.º 2
0
    def build_list(tasks):
        for task in tasks:
            _id = task["id"]
            company_id = task["company-id"]
            start_date = task["start-date"]
            due_date = task["due-date"]
            description = task["description"]
            content = task["content"]
            project_name = task["project-name"]
            project_id = task["project-id"]
            todo_list_name = task["todo-list-name"]
            creator_lastname = task["creator-lastname"]
            creator_firstname = task["creator-firstname"]
            estimated_minutes = task["estimated-minutes"]
            has_dependencies = task["has-dependencies"]
            priority = task["priority"]
            progress = task["progress"]
            last_changed_on = task["last-changed-on"]
            if 'responsible-party-id' in task.keys():
                responsible_party_ids = task["responsible-party-ids"]
                responsible_party_id = task["responsible-party-id"]
                responsible_party_names = task["responsible-party-names"]
                responsible_party_type = task["responsible-party-type"]
                responsible_party_firstname = task[
                    "responsible-party-firstname"]
                responsible_party_lastname = task["responsible-party-lastname"]
                responsible_party_summary = task["responsible-party-summary"]

                tsk = Task(_id, company_id, start_date, due_date, description,
                           content, project_name, project_id, todo_list_name,
                           creator_lastname, creator_firstname,
                           estimated_minutes, has_dependencies, priority,
                           progress, last_changed_on, responsible_party_ids,
                           responsible_party_id, responsible_party_names,
                           responsible_party_type, responsible_party_firstname,
                           responsible_party_lastname,
                           responsible_party_summary)
                TaskListHolder.append_task(tsk)
                continue

            tsk = Task(_id, company_id, start_date, due_date, description,
                       content, project_name, project_id, todo_list_name,
                       creator_lastname, creator_firstname, estimated_minutes,
                       has_dependencies, priority, progress, last_changed_on)

            TaskListHolder.append_task(tsk)
Ejemplo n.º 3
0
def pull_from_teamwork():
    List.clear_task_list()
    company = Database.find_one(CompanyConstants.COLLECTION,
                                {"_id": session["company_id"]})

    TaskObjectBuilder.build_list(
        TaskObjectBuilder.get_from_teamwork_scaled(T.tasks, T.tasks_name,
                                                   session["company_name"],
                                                   company["key"]))
    tsks = List.task_list
    for task in tsks:
        if not DatabaseChecker.does_task_exist_in_db(task):
            if not DatabaseChecker.does_placed_task_exist_in_db(task):
                task.save_to_db()
        elif DatabaseChecker.has_task_been_updated(task):
            # write an update method
            task.update_in_db()
Ejemplo n.º 4
0
def pull_data_from_api():
    pull_from_teamwork()
    company = Database.find_one(CompanyConstants.COLLECTION,
                                {"_id": session["company_id"]})
    List.clear_task_list()
    TaskObjectBuilder.build_completed_list(
        TaskObjectBuilder.get_from_teamwork_scaled(T.completed_tasks,
                                                   T.completed_tasks_name,
                                                   session["company_name"],
                                                   company["key"]))
    ts = List.task_list
    for task in ts:
        if DatabaseChecker.does_task_exist_in_db(task):
            task.delete_from_db()
        elif DatabaseChecker.does_placed_task_exist_in_db(task):
            PlacedTask.remove_placed_task(task.task_id)
    return render_template("FullCalendar.html")
Ejemplo n.º 5
0
    def build_completed_list(tasks):
        for task in tasks:
            _id = task["id"]
            company_id = task["companyId"]
            start_date = task["startDate"]
            due_date = task["dueDate"]
            description = task["description"]
            content = task["content"]
            project_name = task["projectName"]
            project_id = task["projectId"]
            todo_list_name = ""
            creator_lastname = task["creatorLastName"]
            creator_firstname = ""
            estimated_minutes = ""
            has_dependencies = ""
            priority = ""
            progress = ""
            last_changed_on = ""
            responsible_party_ids = ""
            responsible_party_id = ""
            responsible_party_names = ""
            responsible_party_type = ""
            responsible_party_firstname = ""
            responsible_party_lastname = ""
            responsible_party_summary = ""

            tsk = Task(_id, company_id, start_date, due_date, description,
                       content, project_name, project_id, todo_list_name,
                       creator_lastname, creator_firstname, estimated_minutes,
                       has_dependencies, priority, progress, last_changed_on,
                       responsible_party_ids, responsible_party_id,
                       responsible_party_names, responsible_party_type,
                       responsible_party_firstname, responsible_party_lastname,
                       responsible_party_summary)

            TaskListHolder.append_task(tsk)