sort game rankings by kills

This commit is contained in:
Neale Pickett 2024-12-05 15:51:13 -07:00
parent 144d988e5c
commit d88d44f9e7
2 changed files with 7 additions and 2 deletions

View File

@ -95,7 +95,7 @@
<tr>
<th></th>
<th>Name</th>
<th>Score</th>
<th>Kills</th>
<th>Death</th>
<th>Killer</th>
<th>Error</th>

View File

@ -182,7 +182,12 @@ class Replay {
let tbody = this.results.querySelector("tbody")
tbody.replaceChildren()
for (let tank of game.tanks) {
let byKills = Object.keys(game.tanks)
byKills.sort((a, b) => game.tanks[a].kills - game.tanks[b].kills)
byKills.reverse()
for (let i of byKills) {
let tank = game.tanks[i]
let tr = tbody.appendChild(document.createElement("tr"))
let tdSwatch = tr.appendChild(document.createElement("td"))