From ecd0d33ef2eec0df560d5e6d83060a13dc66ca23 Mon Sep 17 00:00:00 2001 From: Skrattoune <56255427+Skrattoune@users.noreply.github.com> Date: Wed, 30 Mar 2022 17:46:30 +0200 Subject: [PATCH] #97 fix indentation + removed double code I let make_complete and make_task_complete as they are slightly different --- huey_monitor/tqdm.py | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/huey_monitor/tqdm.py b/huey_monitor/tqdm.py index afbc908..704cf66 100644 --- a/huey_monitor/tqdm.py +++ b/huey_monitor/tqdm.py @@ -96,12 +96,8 @@ def update_parent_progress(self, n=1): as well as update_dt """ assert self.parent_task_id - - TaskModel.objects.filter(task_id=self.parent_task_id).update( - update_dt=timezone.now(), progress_count=F('progress_count') + n - ) + update_task_progress(self.parent_task_id, n) - def make_complete(self): """ Update TaskModel.total based on TaskModel.progress_count @@ -115,19 +111,19 @@ def make_complete(self): def make_task_complete(task_id): - """ - Update the TaskModel.total corresponding to a given Huey task to match its current progress_count - Used to mark task with unkown number of steps complete - """ - TaskModel.objects.filter(task_id=task_id).update( - update_dt=timezone.now(), total=F('progress_count') - ) + """ + Update the TaskModel.total corresponding to a given Huey task to match its current progress_count + Used to mark task with unkown number of steps complete + """ + TaskModel.objects.filter(task_id=task_id).update( + update_dt=timezone.now(), total=F('progress_count') + ) def update_task_progress(task_id, n=1): - """ - Increment the TaskModel.progress_count corresponding to a given Huey task - and update update_dt - """ - TaskModel.objects.filter(task_id=task_id).update( - update_dt=timezone.now(), progress_count=F('progress_count') + n - ) + """ + Increment the TaskModel.progress_count corresponding to a given Huey task + and update update_dt + """ + TaskModel.objects.filter(task_id=task_id).update( + update_dt=timezone.now(), progress_count=F('progress_count') + n + )