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:
+10
-3
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user