From 8ecedf4fc6f98ae89a08f50bb16aad53b73a8115 Mon Sep 17 00:00:00 2001 From: Hugo Kerstens <hugokk@hotmail.nl> Date: Wed, 22 May 2019 21:06:33 +0200 Subject: [PATCH] Set scan processing status while waiting for a worker --- zesje/api/scans.py | 2 +- zesje/scans.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/zesje/api/scans.py b/zesje/api/scans.py index 88c42c55..d0eecd40 100644 --- a/zesje/api/scans.py +++ b/zesje/api/scans.py @@ -67,7 +67,7 @@ class Scans(Resource): return dict(status=404, message='Exam does not exist.'), 404 scan = Scan(exam=exam, name=args['pdf'].filename, - status='processing', message='importing PDF') + status='processing', message='Waiting...') db.session.add(scan) db.session.commit() diff --git a/zesje/scans.py b/zesje/scans.py index ab4bc4be..bcbde9f6 100644 --- a/zesje/scans.py +++ b/zesje/scans.py @@ -67,6 +67,8 @@ def _process_pdf(scan_id, app_config): # Raises exception if zero or more than one scans found scan = Scan.query.filter(Scan.id == scan_id).one() + report_progress('Importing PDF') + pdf_path = os.path.join(data_directory, 'scans', f'{scan.id}.pdf') output_directory = os.path.join(data_directory, f'{scan.exam.id}_data') -- GitLab