def get_folder_from_department(task): folder = "" task_type = TaskType.get(task.task_type_id) if task_type is not None: task_type = task_info.get_department_from_task_type(task_type) folder = task_type.name return folder
def get_task_type_raw(task_type_id): try: task_type = TaskType.get(task_type_id) except StatementError: raise TaskTypeNotFoundException() if task_type is None: raise TaskTypeNotFoundException() return task_type
def get_task_type_raw(task_type_id): """ Get task type matching given id as an active record. """ try: task_type = TaskType.get(task_type_id) except StatementError: raise TaskTypeNotFoundException() if task_type is None: raise TaskTypeNotFoundException() return task_type
def get_task_types_from_asset_type(data): """ Return a list of task types objects from ids `task_types` list of data dict. Args: data (dict): Data from Resource POST """ task_types = [] if "task_types" in data: try: for task_type_id in data["task_types"]: task_type = TaskType.get(task_type_id) if task_type is not None: task_types.append(task_type) except StatementError: raise TaskTypeNotFoundException() return task_types
def get(self, instance_id): try: task = task_info.get_task(instance_id) except TaskNotFoundException: abort(404) result = task.serialize() task_type = TaskType.get(task.task_type_id) result["task_type"] = task_type.serialize() assigner = Person.get(task.assigner_id) result["assigner"] = assigner.serialize() project = Project.get(task.project_id) result["project"] = project.serialize() task_status = TaskStatus.get(task.task_status_id) result["task_status"] = task_status.serialize() entity = Entity.get(task.entity_id) result["entity"] = entity.serialize() assignees = [] for assignee in task.assignees: assignees.append(assignee.serialize()) result["persons"] = assignees return result, 200
def get_folder_from_task_type(task): folder = "" task_type = TaskType.get(task.task_type_id) if task_type is not None: folder = task_type.name return folder