def calendar(): tasks = Task.get_tasks() if tasks is None: pull_from_teamwork() tasks = Task.get_tasks() if tasks is None: return render_template("FullCalendar.html") return render_template("FullCalendar.html", tasks=tasks)
def post_request(): if request.method == "POST": event_data = request.get_data('data') event_json = Utils.bytes_to_json(event_data) task = TaskObjectBuilder.build_placed_task( Task.get_task(event_json["id"]), event_json["start"], event_json["end"], session["user_id"]) task.save_placed_task() Task.remove_task(event_json["id"]) # add to db.placed_tasks here # delete from db.External_tasks using the id return render_template("FullCalendar.html")
def build_task(task): _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"] 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) return tsk
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)
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)
def does_task_exist_in_db(task): tsk = Task.get_task(task.task_id) if tsk is None: return False else: return True
def has_task_been_updated(task): tsk = Task.get_task(task.task_id) if task.last_changed_on == tsk["last_changed_on"]: return False else: return True