From 25c32d68045c71d3981fa8c58bcd2b7edfd8f358 Mon Sep 17 00:00:00 2001 From: Bastien Abadie <bastien@nextcairn.com> Date: Mon, 29 Mar 2021 18:24:02 +0200 Subject: [PATCH] Update query --- arkindex_worker/worker.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arkindex_worker/worker.py b/arkindex_worker/worker.py index a720d5b1..8ada5915 100644 --- a/arkindex_worker/worker.py +++ b/arkindex_worker/worker.py @@ -941,16 +941,13 @@ class ElementsWorker(BaseWorker): "worker_version", }, "When using the local cache, you can only filter by 'worker_version'" - conditions = [("element_id", "=", convert_str_uuid_to_hex(element.id))] + transcriptions = CachedTranscription.select().where( + CachedTranscription.element_id == element.id + ) if worker_version: - conditions.append( - ("worker_version_id", "=", convert_str_uuid_to_hex(worker_version)) + transcriptions = transcriptions.where( + CachedTranscription.worker_version_id == worker_version ) - - transcriptions = self.cache.fetch( - "transcriptions", - where=conditions, - ) else: if self.cache: logger.warning( -- GitLab