Move core matching factors to the config file

Bonus changes here were making the config a singleton, fixing some more tests and then re-writing the stress test because it was pissing me off.
This commit is contained in:
Marc Di Luzio 2024-08-11 22:07:43 +01:00
parent a5d7dae851
commit 9043615498
6 changed files with 254 additions and 86 deletions

View file

@ -130,10 +130,9 @@ class State():
dict = self._dict
_SCHEMA.validate(dict)
def get_oldest_timestamp(self) -> datetime:
"""Grab the oldest timestamp in history"""
times = (ts_to_datetime(dt) for dt in self._history.keys())
return next(times, None)
def get_history_timestamps(self) -> list[datetime]:
"""Grab all timestamps in the history"""
return sorted([ts_to_datetime(dt) for dt in self._history.keys()])
def get_user_matches(self, id: int) -> list[int]:
return self._users.get(str(id), {}).get(_Key.MATCHES, {})