From 6f1333273e798526afffbdaf3d4f9620f251f88c Mon Sep 17 00:00:00 2001 From: Zebartin <16185081+Zebartin@users.noreply.github.com> Date: Tue, 21 May 2024 10:29:14 +0800 Subject: [PATCH] Opt: Insight in assignment _check_event --- tasks/assignment/assignment.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tasks/assignment/assignment.py b/tasks/assignment/assignment.py index 3019181dd..995b0309f 100644 --- a/tasks/assignment/assignment.py +++ b/tasks/assignment/assignment.py @@ -143,7 +143,7 @@ class Assignment(AssignmentClaim, SynthesizeUI): continue logger.hr('Assignment all', level=2) logger.info(f'Check assignment all: {assignment}') - self.goto_entry(assignment, insight) + self.goto_entry(assignment, insight=insight) status = self._check_assignment_status() if status == AssignmentStatus.CLAIMABLE: self.claim(assignment, None, should_redispatch=False) @@ -202,22 +202,25 @@ class Assignment(AssignmentClaim, SynthesizeUI): if not isinstance(group, AssignmentEventGroup): continue self.goto_group(group) + insight = False for assignment in self._iter_entries(): if assignment in self.dispatched: continue logger.hr('Assignment event', level=2) logger.info(f'Check assignment event: {assignment}') # Order of entries changes if claimed - self.goto_entry(assignment, insight=claimed) + self.goto_entry(assignment, insight=insight) + insight = False status = self._check_assignment_status() if status == AssignmentStatus.LOCKED: continue - if status == AssignmentStatus.CLAIMABLE: + elif status == AssignmentStatus.CLAIMABLE: self.claim(assignment, None, should_redispatch=False) claimed = True - if status == AssignmentStatus.DISPATCHABLE: + insight = True + elif status == AssignmentStatus.DISPATCHABLE: self.dispatch(assignment, None) - if status == AssignmentStatus.DISPATCHED: + elif status == AssignmentStatus.DISPATCHED: self.dispatched[assignment] = datetime.now() + \ self._get_assignment_time() return claimed