From cd81ee31402f521a75a7f9203dd792082f4fc7c0 Mon Sep 17 00:00:00 2001 From: alwayscompiling Date: Sun, 31 Jul 2022 10:57:45 -0400 Subject: [PATCH] Change score score to be score value. --- data/category.py | 2 +- data/score.py | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/data/category.py b/data/category.py index 0dfe128..e4cdf9a 100644 --- a/data/category.py +++ b/data/category.py @@ -83,6 +83,6 @@ class Category: data["time_record"] = self.time_record data["scores"] = {} for score in self.scores: - data["scores"][score.user] = score.score + data["scores"][score.user] = score.value return data diff --git a/data/score.py b/data/score.py index dde7062..811e8b6 100644 --- a/data/score.py +++ b/data/score.py @@ -8,9 +8,9 @@ class Score: # no user setter, it should never change. - def __init__(self, user: str, score: int) -> None: + def __init__(self, user: str, value: int) -> None: self._user: str = user - self._score: int = score + self._value: int = value def __str__(self) -> str: return f"{self.user}: {self.get_str()}" @@ -21,18 +21,18 @@ class Score: return self._user @property - def score(self) -> int: + def value(self) -> int: """Getter for score value.""" - return self._score + return self._value - @score.setter - def score(self, score: int) -> None: + @value.setter + def value(self, value: int) -> None: """Setter for score value.""" - self._score = score + self._value = value def get_str(self) -> str: """Gets score's value as a string.""" - return str(self._score) + return str(self._value) class ScoreTime(Score): @@ -44,16 +44,16 @@ class ScoreTime(Score): self._score: float = score @property - def score(self) -> float: + def value(self) -> float: """Getter for score value.""" return self._score - @score.setter - def score(self, score: float) -> None: + @value.setter + def value(self, value: float) -> None: """Setter for score value.""" - self._score = score + self._score = value def get_str(self) -> str: """Gets score's value as a string. Returns in time format.""" - milliseconds = round((self.score - int(self.score)) * 10) - return time.strftime(f"%-M:%S.{milliseconds}", time.gmtime(self.score)) + milliseconds = round((self.value - int(self.value)) * 10) + return time.strftime(f"%-M:%S.{milliseconds}", time.gmtime(self.value))