Skip to content

Commit

Permalink
boxine#97 fix indentation + removed double code
Browse files Browse the repository at this point in the history
I let make_complete and make_task_complete as they are slightly different
  • Loading branch information
Skrattoune authored Mar 30, 2022
1 parent b7edda1 commit ecd0d33
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions huey_monitor/tqdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)

0 comments on commit ecd0d33

Please sign in to comment.