Create autofill functions for users in category and in table. Add function in category class to return a list of all users.

This commit is contained in:
alwayscompiling
2022-11-22 16:26:31 -05:00
parent 8155fb0c8f
commit a0c5527bf6
2 changed files with 80 additions and 21 deletions
+10 -3
View File
@@ -128,9 +128,7 @@ class Category:
else:
self._scores_map[score.user] = score
self._scores_map = dict(
sorted(self._scores_map.items(), key=lambda x: x[1].value, reverse=not self.ascending)
)
self._scores_map = dict(sorted(self._scores_map.items(), key=lambda x: x[1].value, reverse=not self.ascending))
def clear(self) -> None:
"""
@@ -139,6 +137,15 @@ class Category:
"""
self._scores_map.clear()
def get_users(self) -> "list[str]":
"""
Returns list of users in this category.
Returns:
list[str]: List of all users in category.
"""
return self._scores_map.keys()
def get_user_score(self, user: str) -> Score:
"""
Gets a user's score. Returns None if user is not found.