Skip to content

Commit

Permalink
Merge pull request #917 from EvanBldy/main
Browse files Browse the repository at this point in the history
various improvements
  • Loading branch information
EvanBldy authored Feb 7, 2025
2 parents db93f52 + 1d55788 commit 98dd500
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 23 deletions.
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ install_requires =
psycopg[binary]==3.2.4
pyotp==2.9.0
pysaml2==7.5.0
python-nomad==2.0.1
python-nomad==2.1.0
python-slugify==8.0.4
python-socketio==5.12.1
pytz==2025.1
Expand All @@ -77,7 +77,7 @@ install_requires =
rq==2.1.0
slackclient==2.9.4
sqlalchemy_utils==0.41.2
sqlalchemy==2.0.37
sqlalchemy==2.0.38
ua-parser==1.0.1
werkzeug==3.1.3

Expand Down
3 changes: 1 addition & 2 deletions zou/app/blueprints/assets/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ def get(self):
description: All assets with tasks
"""
criterions = query.get_query_criterions_from_request(request)
page = self.get_page()
check_criterion_access(criterions)
if permissions.has_vendor_permissions():
criterions["assigned_to"] = persons_service.get_current_user()[
Expand All @@ -150,7 +149,7 @@ def get(self):
str(department.id)
for department in persons_service.get_current_user_raw().departments
]
return assets_service.get_assets_and_tasks(criterions, page)
return assets_service.get_assets_and_tasks(criterions)


class AssetTypeResource(Resource):
Expand Down
7 changes: 0 additions & 7 deletions zou/app/blueprints/crud/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ def build_filters(self, options):
name_filter,
criterions,
) = super().build_filters(options)
if "project_id" in criterions:
del criterions["project_id"]
if "episode_id" in criterions:
del criterions["episode_id"]
return (
Expand All @@ -61,7 +59,6 @@ def build_filters(self, options):
def apply_filters(self, query, options):
query = super().apply_filters(query, options)

project_id = options.get("project_id", None)
episode_id = options.get("episode_id", None)
if episode_id is not None:
Sequence = aliased(Entity)
Expand All @@ -70,10 +67,6 @@ def apply_filters(self, query, options):
.join(Sequence, Entity.parent_id == Sequence.id)
.filter(Sequence.parent_id == episode_id)
)
elif project_id is not None:
query = query.join(Entity, Task.entity_id == Entity.id).filter(
Entity.project_id == project_id
)

return query

Expand Down
2 changes: 1 addition & 1 deletion zou/app/services/assets_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def get_full_assets(criterions={}):
return assets


def get_assets_and_tasks(criterions={}, page=1, with_episode_ids=False):
def get_assets_and_tasks(criterions={}, with_episode_ids=False):
"""
Get all assets for given criterions with related tasks for each asset.
"""
Expand Down
19 changes: 8 additions & 11 deletions zou/app/services/playlists_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ def get_playlist_with_preview_file_revisions(playlist_id):
shot["preview_file_status"] = preview_file["status"]
shot["preview_file_annotations"] = preview_file["annotations"]
shot["preview_file_task_id"] = preview_file["task_id"]
shot["preview_file_previews"] = preview_file["previews"]
shot["preview_file_previews"] = preview_file.get(
"previews", []
)
else:
del shot["preview_file_id"]
except Exception as e:
Expand Down Expand Up @@ -234,7 +236,6 @@ def set_preview_files_for_entities(playlist_dict):
.all()
)

is_pictures = False
for preview_file, task_type_id, entity_id in preview_files:
entity_id = str(entity_id)
task_type_id = str(task_type_id)
Expand All @@ -244,9 +245,6 @@ def set_preview_files_for_entities(playlist_dict):
if task_type_id not in previews[entity_id]:
previews[entity_id][task_type_id] = []

if preview_file.extension == "png":
is_pictures = True

task_id = str(preview_file.task_id)
preview_file_id = str(preview_file.id)

Expand All @@ -265,12 +263,11 @@ def set_preview_files_for_entities(playlist_dict):
previews[entity_id][task_type_id].append(light_preview_file)
preview_file_map[preview_file_id] = light_preview_file

if is_pictures:
for entity_id in previews.keys():
for task_type_id in previews[entity_id].keys():
previews[entity_id][task_type_id] = mix_preview_file_revisions(
previews[entity_id][task_type_id]
)
for entity_id in previews.keys():
for task_type_id in previews[entity_id].keys():
previews[entity_id][task_type_id] = mix_preview_file_revisions(
previews[entity_id][task_type_id]
)

for entity in playlist_dict["shots"]:
if str(entity["id"]) in previews:
Expand Down

0 comments on commit 98dd500

Please sign in to comment.