From: mar77i Date: Fri, 30 Aug 2024 09:34:59 +0000 (+0200) Subject: if the door is open and we're there, don't queue X-Git-Url: https://git.mar77i.info/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=elevator if the door is open and we're there, don't queue --- diff --git a/elevator.py b/elevator.py index a6c8f83..e7ad1ee 100755 --- a/elevator.py +++ b/elevator.py @@ -308,8 +308,9 @@ class Elevator: return None def open_if_there(self, level): - if self.get_whole_level() == level and self.doors[level].state != Door.OPEN: - self.doors[level].open() + if self.get_whole_level() == level: + if self.doors[level].state != Door.OPEN: + self.doors[level].open() return True return False