mirror of
https://github.com/brandon-rozek/wordguess
synced 2024-12-03 12:00:46 -05:00
Fixed none issue
This commit is contained in:
parent
8d964f609b
commit
35a18960cd
1 changed files with 4 additions and 1 deletions
|
@ -14,12 +14,15 @@ if __name__ == "__main__":
|
||||||
args = vars(parser.parse_args())
|
args = vars(parser.parse_args())
|
||||||
|
|
||||||
# If not specified, then use today's date
|
# 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)
|
con = sqlite3.connect(WordGuess.RESULTS_LOCATION)
|
||||||
try:
|
try:
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
res = cur.execute(f"SELECT user, score FROM scores WHERE date = '{DATE}' ORDER BY score DESC")
|
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():
|
for username, score in res.fetchall():
|
||||||
print(username, score)
|
print(username, score)
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in a new issue