make playerSearch results dataTable

This commit is contained in:
2020-12-18 12:33:37 +01:00
parent 3b678ab4a8
commit 5e035c2a4f
2 changed files with 14 additions and 2 deletions

View File

@@ -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

View File

@@ -36,6 +36,14 @@
</table>
{{ endOfBoardIndicator }}
</div>
{% include 'footer.html' %}
{% if not doNotComputeRank %}
<script defer>
$(document).ready(function () {
$('#tableMain').DataTable();
$('.dataTables_length').addClass('bs-select');
});
</script>
{% endif }
{% include 'footer.html' %}
</body>
</html>