From 5e035c2a4f5acbe6c793c1f34e62ed64d15c2c8d Mon Sep 17 00:00:00 2001 From: Sheppy Date: Fri, 18 Dec 2020 12:33:37 +0100 Subject: [PATCH] make playerSearch results dataTable --- database.py | 6 +++++- templates/base.html | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/database.py b/database.py index 11c3430..2a821b8 100644 --- a/database.py +++ b/database.py @@ -104,11 +104,15 @@ class DatabaseConnection: return [p] playerRows = [] - cursor.execute("SELECT * FROM players WHERE name LIKE ?", (playerNamePrepared,)) + cursor.execute("SELECT * FROM players WHERE name LIKE ? ORDER BY games DESC", (playerNamePrepared,)) + count = 0 for pr in cursor: + if count > 50: + break; p = player.PlayerInLeaderboard(pr) p.rank = self.getPlayerRank(p) playerRows += [p] + count += 1 return playerRows diff --git a/templates/base.html b/templates/base.html index baa4ee7..cc2a944 100644 --- a/templates/base.html +++ b/templates/base.html @@ -36,6 +36,14 @@ {{ endOfBoardIndicator }} - {% include 'footer.html' %} + {% if not doNotComputeRank %} + + {% endif } + {% include 'footer.html' %}