From 9eb12a165b02aa0fc04bf48d710f5d005c25952f Mon Sep 17 00:00:00 2001 From: Declan Hoare Date: Fri, 17 Apr 2020 18:46:12 +1000 Subject: [PATCH] Order Pong Highscores I had expected the client to sort it and allow the user to choose ordering by level or codepoints, but it only displays the results in the order they are sent. --- unite.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unite.py b/unite.py index b5515cc..678f09b 100644 --- a/unite.py +++ b/unite.py @@ -155,8 +155,8 @@ def get_display_name(uid, dbsession, authsession): def get_pong_highscores(dbsession, authsession): return flask.jsonify({"Pages": 0, # unused "Highscores": [mapping.map_to(user, mappings["PongHighscore"]) - for user in dbsession.query(User).all() - if user.PongLevel is not None and user.PongCP is not None]}) + for user in dbsession.query(User).filter(User.PongLevel.isnot(None)).filter(User.PongCP.isnot(None)) + .order_by(User.PongCP.desc()).all()]}) @api_route("/GetEmail") def get_email(dbsession, authsession):