Skip to content

Commit c07c2a3

Browse files
committed
fix fill of own attrib for project
1 parent e1716a6 commit c07c2a3

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

ayon_api/_api_helpers/projects.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import copy
34
import json
45
import platform
56
import warnings
@@ -810,8 +811,21 @@ def _get_graphql_projects(
810811
for project in parsed_data["projects"]:
811812
if active is not None and active is not project["active"]:
812813
continue
813-
if own_attributes:
814-
fill_own_attribs(project)
814+
815+
all_attrib = project.get("allAttrib")
816+
if isinstance(all_attrib, str):
817+
all_attrib = json.loads(all_attrib)
818+
project["allAttrib"] = all_attrib
819+
820+
if own_attributes and all_attrib:
821+
own_attrib = {}
822+
if all_attrib:
823+
own_attrib = copy.deepcopy(all_attrib)
824+
attrib = project.get("attrib", {})
825+
for key in attrib.keys():
826+
own_attrib.setdefault(key, None)
827+
project["ownAttrib"] = own_attrib
828+
815829
self._fill_project_entity_data(project)
816830
yield project
817831

ayon_api/server_api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,8 +2425,11 @@ def _prepare_fields(
24252425
fields.remove("attrib")
24262426
fields |= self.get_attributes_fields_for_type(entity_type)
24272427

2428-
if own_attributes and entity_type in {"project", "folder", "task"}:
2429-
fields.add("ownAttrib")
2428+
if own_attributes:
2429+
if entity_type == "project":
2430+
fields.add("allAttrib")
2431+
elif entity_type in {"folder", "task"}:
2432+
fields.add("ownAttrib")
24302433

24312434
if entity_type != "project":
24322435
return

0 commit comments

Comments
 (0)