Add shot/asset typing and owned task types to departments
Departments now carry a type (shot or asset) and own a list of task types (e.g. Animation: blocking/primary_pass/second_pass, Composite: first_pass/second_pass, plus a new Simulation department), additive to the existing flat Custom Task Type system. When a task's type belongs to a department, its department is derived and kept in sync server-side across create/update paths; Task Type is now editable in the Task Detail panel and Department options are filtered to the task's shot/asset scope.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
"""Shared helpers for resolving the department that owns a given task type."""
|
||||
from typing import Optional
|
||||
|
||||
|
||||
def find_owning_department(db_project, task_type: str) -> Optional[str]:
|
||||
"""Return the name of the department (standard or custom) whose task_types
|
||||
list contains task_type for this project, or None if no department owns it."""
|
||||
if not task_type:
|
||||
return None
|
||||
|
||||
from routers.projects import STANDARD_DEPARTMENTS
|
||||
|
||||
for department in STANDARD_DEPARTMENTS:
|
||||
if task_type in department["task_types"]:
|
||||
return department["name"]
|
||||
|
||||
for department in (db_project.custom_departments or []):
|
||||
if task_type in department.get("task_types", []):
|
||||
return department["name"]
|
||||
|
||||
return None
|
||||
Reference in New Issue
Block a user