예제 #1
0
 def get(self, entity_id, task_type_id):
     """
     Return tasks related to given entity asset, episode, sequence, shot or scene.
     ---
     tags:
     - Tasks
     parameters:
       - in: path
         name: entity_id
         required: True
         schema:
             type: UUID
             example: a24a6ea4-ce75-4665-a070-57453082c25
       - in: path
         name: task_type_id
         required: True
         schema:
             type: UUID
             example: a24a6ea4-ce75-4665-a070-57453082c25
     responses:
         200:
             description: Tasks related to given entity asset, episode, sequence, shot or scene
     """
     entity = entities_service.get_entity(entity_id)
     user_service.check_project_access(entity["project_id"])
     return tasks_service.get_tasks_for_entity_and_task_type(
         entity_id, task_type_id)
예제 #2
0
파일: resources.py 프로젝트: eliemichel/zou
 def get(self, entity_id, task_type_id):
     entity = entities_service.get_entity(entity_id)
     user_service.check_project_access(entity["project_id"])
     return tasks_service.get_tasks_for_entity_and_task_type(
         entity_id,
         task_type_id
     )
예제 #3
0
파일: resources.py 프로젝트: Tesla-Coil/zou
 def get(self, entity_id, task_type_id):
     entity = entities_service.get_entity(entity_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(entity["project_id"])
     return tasks_service.get_tasks_for_entity_and_task_type(
         entity_id,
         task_type_id
     )
예제 #4
0
def _run_status_automation(automation, task, person_id):
    is_automation_to_run = (
        task["task_type_id"] == automation["in_task_type_id"]
        and task["task_status_id"] == automation["in_task_status_id"])
    if not is_automation_to_run:
        return

    priorities = projects_service.get_task_type_priority_map(
        task["project_id"], automation["entity_type"].capitalize())
    in_priority = priorities.get(automation["in_task_type_id"], 0) or 0
    out_priority = priorities.get(automation["out_task_type_id"], 0) or 0
    is_rollback = (priorities is not None
                   and automation["out_field_type"] != "ready_for"
                   and in_priority > out_priority)
    if is_rollback:  # Do not apply rollback to avoid change cycles.
        return

    if automation["out_field_type"] == "status":
        tasks_to_update = tasks_service.get_tasks_for_entity_and_task_type(
            task["entity_id"], automation["out_task_type_id"])
        if len(tasks_to_update) > 0:
            task_to_update = tasks_to_update[0]
            task_type = tasks_service.get_task_type(
                automation["in_task_type_id"])
            task_status = tasks_service.get_task_status(
                automation["in_task_status_id"])
            create_comment(
                person_id,
                task_to_update["id"],
                automation["out_task_status_id"],
                "Change triggered by %s set to %s" % (
                    task_type["name"],
                    task_status["name"],
                ),
                [],
                {},
                None,
            )
    elif automation["out_field_type"] == "ready_for":
        try:
            asset = assets_service.update_asset(
                task["entity_id"],
                {"ready_for": automation["out_task_type_id"]},
            )
            breakdown_service.refresh_casting_stats(asset)
        except AssetNotFoundException:
            pass