mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
make sure output of get_representations_parents always returns values for passed repre ids
This commit is contained in:
parent
2527ac0372
commit
63f5ea427a
2 changed files with 5 additions and 7 deletions
|
|
@ -1012,8 +1012,10 @@ def get_representations_parents(project_name, representations):
|
|||
versions_by_subset_id = collections.defaultdict(list)
|
||||
subsets_by_subset_id = {}
|
||||
subsets_by_asset_id = collections.defaultdict(list)
|
||||
output = {}
|
||||
for representation in representations:
|
||||
repre_id = representation["_id"]
|
||||
output[repre_id] = (None, None, None, None)
|
||||
version_id = representation["parent"]
|
||||
repres_by_version_id[version_id].append(representation)
|
||||
|
||||
|
|
@ -1043,7 +1045,6 @@ def get_representations_parents(project_name, representations):
|
|||
|
||||
project = get_project(project_name)
|
||||
|
||||
output = {}
|
||||
for version_id, representations in repres_by_version_id.items():
|
||||
asset = None
|
||||
subset = None
|
||||
|
|
@ -1083,7 +1084,7 @@ def get_representation_parents(project_name, representation):
|
|||
parents_by_repre_id = get_representations_parents(
|
||||
project_name, [representation]
|
||||
)
|
||||
return parents_by_repre_id.get(repre_id)
|
||||
return parents_by_repre_id[repre_id]
|
||||
|
||||
|
||||
def get_thumbnail_id_from_source(project_name, src_type, src_id):
|
||||
|
|
|
|||
|
|
@ -296,12 +296,9 @@ def update_package_version(container, version):
|
|||
|
||||
assert current_representation is not None, "This is a bug"
|
||||
|
||||
repre_parents = get_representation_parents(
|
||||
project_name, current_representation
|
||||
version_doc, subset_doc, asset_doc, project_doc = (
|
||||
get_representation_parents(project_name, current_representation)
|
||||
)
|
||||
version_doc = subset_doc = asset_doc = project_doc = None
|
||||
if repre_parents:
|
||||
version_doc, subset_doc, asset_doc, project_doc = repre_parents
|
||||
|
||||
if version == -1:
|
||||
new_version = get_last_version_by_subset_id(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue