From d664fcbdc45fc62169f2b96ef40c5aeac887d2e4 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Fri, 21 Jul 2023 13:06:18 +0000 Subject: [PATCH] refactor(jobs):track 100-on-finished as a progress update --- selfprivacy_api/jobs/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/selfprivacy_api/jobs/__init__.py b/selfprivacy_api/jobs/__init__.py index ea1e15e..3fe452b 100644 --- a/selfprivacy_api/jobs/__init__.py +++ b/selfprivacy_api/jobs/__init__.py @@ -198,12 +198,15 @@ class Jobs: job.description = description if status_text is not None: job.status_text = status_text - if status == JobStatus.FINISHED: - job.progress = 100 - if progress is not None: - # explicitly provided progress has priority + + # if it is finished it is 100 + # unless user says otherwise + if status == JobStatus.FINISHED and progress is None: + progress = 100 + if progress is not None and job.progress != progress: job.progress = progress Jobs.log_progress_update(job, progress) + job.status = status Jobs.log_status_update(job, status) job.updated_at = datetime.datetime.now()