From 73273bc5cd43d6be3acd034be11d0e5b03560e4f Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Sun, 3 Mar 2024 16:02:20 +0100 Subject: [PATCH] Small database migration fixes --- formula10/__init__.py | 3 +-- formula10/domain/model/season_guess.py | 9 +++++++++ formula10/domain/model/season_guess_result.py | 9 +++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/formula10/__init__.py b/formula10/__init__.py index 631c940..6ec0860 100644 --- a/formula10/__init__.py +++ b/formula10/__init__.py @@ -35,10 +35,9 @@ import formula10.controller.error_controller # Large DB Update # - Don't use names for frontend post requests, either use IDs or post the whole object (if its possible)... # - For season guess calc there is missing: Fastest laps + sprint points + sprint DNFs (in race result) -# - Fix Valtteri/Russel spelling errors # - Mask to allow changing usernames (easy if name is not used as ID) # - Maybe even masks for races + drivers + teams? -# - DB fields for links to F1 site +# - DB fields for links to F1 site - NO: just hardcode them in with a dictionary # - DB fields for qualifying dates # Leaderboards/Points diff --git a/formula10/domain/model/season_guess.py b/formula10/domain/model/season_guess.py index 900f83c..c0b458c 100644 --- a/formula10/domain/model/season_guess.py +++ b/formula10/domain/model/season_guess.py @@ -58,6 +58,15 @@ class SeasonGuess(): return db_season_guess + def __eq__(self, __value: object) -> bool: + if isinstance(__value, SeasonGuess): + return self.user == __value.user + + return NotImplemented + + def __hash__(self) -> int: + return hash(self.user) + user: User hot_take: str | None p2_wcc: Team | None diff --git a/formula10/domain/model/season_guess_result.py b/formula10/domain/model/season_guess_result.py index b08c3da..a478536 100644 --- a/formula10/domain/model/season_guess_result.py +++ b/formula10/domain/model/season_guess_result.py @@ -18,6 +18,15 @@ class SeasonGuessResult(): db_season_guess_result.overtakes_correct = self.overtakes_correct return db_season_guess_result + def __eq__(self, __value: object) -> bool: + if isinstance(__value, SeasonGuessResult): + return self.user == __value.user + + return NotImplemented + + def __hash__(self) -> int: + return hash(self.user) + user: User hot_take_correct: bool overtakes_correct: bool \ No newline at end of file