Change score score to be score value.

This commit is contained in:
alwayscompiling
2022-07-31 10:57:45 -04:00
parent 6ddba14908
commit cd81ee3140
2 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -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
+14 -14
View File
@@ -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))