Skip to content
Snippets Groups Projects
Verified Commit 3f2c59bf authored by Yoann Schneider's avatar Yoann Schneider :tennis:
Browse files

better peewee syntax

parent 10d9d1e0
No related branches found
No related tags found
1 merge request!324Expose transcription metadata and worker run query params on ListElementChildren
Pipeline #80224 passed
...@@ -410,14 +410,21 @@ class ElementMixin(object): ...@@ -410,14 +410,21 @@ class ElementMixin(object):
query = query.where(CachedElement.type == type) query = query.where(CachedElement.type == type)
if worker_version is not None: if worker_version is not None:
# If worker_version=False, filter by manual worker_version e.g. None # If worker_version=False, filter by manual worker_version e.g. None
worker_version_id = worker_version if worker_version else None worker_version_id = worker_version or None
query = query.where( if worker_version_id:
CachedElement.worker_version_id == worker_version_id query = query.where(
) CachedElement.worker_version_id == worker_version_id
)
else:
query = query.where(CachedElement.worker_version_id.is_null())
if worker_run is not None: if worker_run is not None:
# If worker_run=False, filter by manual worker_run e.g. None # If worker_run=False, filter by manual worker_run e.g. None
worker_run_id = worker_run or None worker_run_id = worker_run or None
query = query.where(CachedElement.worker_run_id == worker_run_id) if worker_run_id:
query = query.where(CachedElement.worker_run_id == worker_run_id)
else:
query = query.where(CachedElement.worker_run_id.is_null())
return query return query
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment