Loading poolpay/director/Director.py +16 −1 Original line number Diff line number Diff line from dataclasses import dataclass, field from time import monotonic from time import monotonic, sleep from poolpay import db from poolpay.display.Display import Display Loading Loading @@ -58,8 +58,23 @@ class Director: def card_removed(self) -> None: self._last_card_removed_at = monotonic() self._ensure_minimum_presentation_time() self.nothing_requested() def _ensure_minimum_presentation_time(self) -> None: """ Ensure that the time between the presentation of a "card presented" scene lasts for at least a certain time. """ if self._last_card_removed_at is None or self._last_card_presented_at is None: assert False, "Card removal and presentation timestamps should be set" return presentation_time = self._last_card_removed_at - self._last_card_presented_at minimum_presentation_time = 3 sleep(max(0, minimum_presentation_time - presentation_time)) def nothing_requested(self) -> None: self._next_scene_on_card_presented = self.play.PaymentSuccess self.play.Idle(self, price_cents=DRINK).present() Loading Loading
poolpay/director/Director.py +16 −1 Original line number Diff line number Diff line from dataclasses import dataclass, field from time import monotonic from time import monotonic, sleep from poolpay import db from poolpay.display.Display import Display Loading Loading @@ -58,8 +58,23 @@ class Director: def card_removed(self) -> None: self._last_card_removed_at = monotonic() self._ensure_minimum_presentation_time() self.nothing_requested() def _ensure_minimum_presentation_time(self) -> None: """ Ensure that the time between the presentation of a "card presented" scene lasts for at least a certain time. """ if self._last_card_removed_at is None or self._last_card_presented_at is None: assert False, "Card removal and presentation timestamps should be set" return presentation_time = self._last_card_removed_at - self._last_card_presented_at minimum_presentation_time = 3 sleep(max(0, minimum_presentation_time - presentation_time)) def nothing_requested(self) -> None: self._next_scene_on_card_presented = self.play.PaymentSuccess self.play.Idle(self, price_cents=DRINK).present() Loading