]> git.mar77i.info Git - elevator/commitdiff
if the door is open and we're there, don't queue master
authormar77i <mar77i@protonmail.ch>
Fri, 30 Aug 2024 09:34:59 +0000 (11:34 +0200)
committermar77i <mar77i@protonmail.ch>
Fri, 30 Aug 2024 09:34:59 +0000 (11:34 +0200)
elevator.py

index a6c8f83207a0b1ff8e8575eb85b06a47dd075b29..e7ad1ee08ff1e7f25bc0b01e575de8aa5d5c5f2b 100755 (executable)
@@ -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