summaryrefslogtreecommitdiff
path: root/src/match_up/utilities.py
diff options
context:
space:
mode:
authorKaran Jayachandra <mail@karanjayachandra.com>2024-11-15 13:08:05 +0100
committerKaran Jayachandra <mail@karanjayachandra.com>2024-11-15 13:08:05 +0100
commite8ae44bebdd072b7b555cca5e0b8389d0eb3dbfd (patch)
tree47d7827bd3f408e81f4ca604011b4d035acc6b6b /src/match_up/utilities.py
parentffaca550cbbf89942fbf5b82ad911d75da1c3c51 (diff)
Removed the timer from the backend
Diffstat (limited to 'src/match_up/utilities.py')
-rw-r--r--src/match_up/utilities.py30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/match_up/utilities.py b/src/match_up/utilities.py
index 8a905ba..8aadfd2 100644
--- a/src/match_up/utilities.py
+++ b/src/match_up/utilities.py
@@ -27,33 +27,3 @@ def sample_list(indices: list, cost: list[int], count: int = None) -> list:
indices, cost = _shuffle_two_lists(indices, cost)
indices = _pick_from_list_after_sorting_other(indices, cost)[:count]
return indices
-
-
-@dataclass
-class Timer:
- max_mins: float = DEFAULT_TIMER
- ref: float = None
- running: bool = False
- default: str = ("00", "00")
-
- def __post_init__(self):
- self.max_seconds = self.max_mins * SECS_IN_MIN
-
- def start(self):
- self.ref = time() + self.max_seconds
- self.running = True
-
- def stop(self):
- self.ref = None
- self.running = False
-
- def get(self):
- if not self.running:
- return self.default
- total_seconds = self.ref - time()
- if total_seconds < 0:
- self.stop()
- return self.default
- mins = f"{int(total_seconds // SECS_IN_MIN):02d}"
- secs = f"{int(total_seconds % SECS_IN_MIN):02d}"
- return mins, secs