Skip to content

Commit

Permalink
fix: better count when done
Browse files Browse the repository at this point in the history
  • Loading branch information
db0 committed Oct 1, 2024
1 parent 6b8da9b commit 7310ea7
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions horde/classes/base/waiting_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,15 +300,27 @@ def is_completed(self):
db.session.query(procgen_class.wp_id)
.filter(
procgen_class.wp_id == self.id,
procgen_class.fake == False, # noqa E712
procgen_class.fake.is_(False),
or_(
procgen_class.faulted == True, # noqa E712
procgen_class.faulted.is_(True),
procgen_class.generation != None, # noqa E712
),
)
.count()
)
if finished_procgens < self.jobs:
processing_procgens = (
db.session.query(procgen_class.wp_id)
.filter(
procgen_class.wp_id == self.id,
procgen_class.fake.is_(False),
or_(
procgen_class.faulted.is_(False),
procgen_class.generation.is_(None),
),
)
.count()
)
if finished_procgens - processing_procgens < self.jobs:
return False
return True

Expand Down

0 comments on commit 7310ea7

Please sign in to comment.