dashboard wrong points workaround

dashboard now shows the points of every user with same username
This commit is contained in:
2022-10-20 16:10:28 +02:00
parent f0077c56dc
commit 2cf2050dac
3 changed files with 14 additions and 16 deletions
+4 -8
View File
@@ -46,18 +46,14 @@ def read_users_points(db, user_id):
print("To user:", user_id)
def read_users_points_from_username(db, username):
"""Returns None if user doesn't exist, their points otherwise."""
def read_all_users_with_username(db, username):
try:
cursor = db.execute(
"SELECT points FROM points WHERE name = ?",
"SELECT name, points FROM points WHERE name = ?",
(username,)
)
points = cursor.fetchone()
if points is None:
return None
else:
return points[0]
users = cursor.fetchall()
return users
except Error as e:
print("Error occured reading points from username:", e.args[0])
print("To user:", username)