Merge pull request #117 from Zebartin/dev

Fix: Ensure exiting assignment report
This commit is contained in:
LmeSzinc 2023-09-28 23:26:21 +08:00 committed by GitHub
commit 271bdc9e1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -58,10 +58,10 @@ ENTRY_LOADED = ButtonWrapper(
name='ENTRY_LOADED',
share=Button(
file='./assets/share/assignment/ui/ENTRY_LOADED.png',
area=(467, 235, 498, 619),
search=(447, 215, 518, 639),
color=(217, 214, 205),
button=(467, 235, 498, 619),
area=(474, 161, 491, 615),
search=(454, 141, 511, 635),
color=(197, 193, 186),
button=(474, 161, 491, 615),
),
)
EXP_MATERIALS_CREDITS_CHECK = ButtonWrapper(
@ -108,6 +108,23 @@ GROUP_SEARCH = ButtonWrapper(
button=(111, 76, 835, 140),
),
)
LOCKED = ButtonWrapper(
name='LOCKED',
cn=Button(
file='./assets/cn/assignment/ui/LOCKED.png',
area=(752, 551, 793, 572),
search=(732, 531, 813, 592),
color=(122, 117, 110),
button=(752, 551, 793, 572),
),
en=Button(
file='./assets/en/assignment/ui/LOCKED.png',
area=(760, 551, 839, 571),
search=(740, 531, 859, 591),
color=(107, 102, 93),
button=(760, 551, 839, 571),
),
)
OCR_ASSIGNMENT_ENTRY_LIST = ButtonWrapper(
name='OCR_ASSIGNMENT_ENTRY_LIST',
share=Button(

View File

@ -80,9 +80,11 @@ class AssignmentClaim(AssignmentDispatch):
logger.info('Assignment report is closed')
break
# Close report
if self.appear(REPORT, interval=2):
if self.appear(REPORT, interval=1):
self.device.click(click_button)
continue
# Ensure report totally disappears
self._wait_until_entry_loaded()
def _is_duration_expected(self, duration: int) -> bool:
"""

View File

@ -196,8 +196,7 @@ class AssignmentUI(UI):
if timeout.reached():
logger.warning('Wait entry loaded timeout')
break
# Maybe not reliable
if self.image_color_count(ENTRY_LOADED, (35, 35, 35)):
if self.image_color_count(ENTRY_LOADED, (35, 35, 35), count=800):
logger.info('Entry loaded')
break
@ -225,7 +224,7 @@ class AssignmentUI(UI):
self.device.screenshot()
if timeout.reached():
logger.info(
logger.warning(
'Check assignment status timeout, assume LOCKED'
)
break
@ -238,6 +237,9 @@ class AssignmentUI(UI):
if self.appear(EMPTY_SLOT):
ret = AssignmentStatus.DISPATCHABLE
break
if self.appear(LOCKED):
ret = AssignmentStatus.LOCKED
break
logger.attr('AssignmentStatus', ret.name)
return ret