Skip to content

Commit

Permalink
feat: limit the fetch of EntityLink to what is necessary on get_asset…
Browse files Browse the repository at this point in the history
…s_and_tasks() (#908)
  • Loading branch information
Acedyn authored Jan 9, 2025
1 parent 9a16f1c commit 79f0247
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions zou/app/services/assets_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,15 @@ def get_assets_and_tasks(criterions={}, page=1, with_episode_ids=False):
episode_links_query = episode_links_query.filter(
Episode.project_id == criterions["project_id"]
)
if "episode_id" in criterions:
episode_links_query = episode_links_query.filter(
EntityLink.entity_in_id == criterions["episode_id"]
)
if "id" in criterions:
episode_links_query = episode_links_query.filter(
EntityLink.entity_out_id == criterions["id"]
)

for link in episode_links_query.all():
if str(link.entity_out_id) not in cast_in_episode_ids:
cast_in_episode_ids[str(link.entity_out_id)] = []
Expand Down

0 comments on commit 79f0247

Please sign in to comment.