Fixed none issue

This commit is contained in:
Brandon Rozek 2024-01-06 13:58:11 -05:00
parent 8d964f609b
commit 35a18960cd
No known key found for this signature in database
GPG key ID: 26E457DA82C9F480

View file

@ -14,12 +14,15 @@ if __name__ == "__main__":
args = vars(parser.parse_args())
# If not specified, then use today's date
DATE = args.get("date", str(datetime.today().date()))
DATE = args.get("date")
if DATE is None:
DATE = str(datetime.today().date())
con = sqlite3.connect(WordGuess.RESULTS_LOCATION)
try:
cur = con.cursor()
res = cur.execute(f"SELECT user, score FROM scores WHERE date = '{DATE}' ORDER BY score DESC")
print(f"High scores for date '{DATE}'")
for username, score in res.fetchall():
print(username, score)
finally: