mirror of https://github.com/dirtbags/tanks.git
sort game rankings by kills
This commit is contained in:
parent
144d988e5c
commit
d88d44f9e7
|
@ -95,7 +95,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Score</th>
|
<th>Kills</th>
|
||||||
<th>Death</th>
|
<th>Death</th>
|
||||||
<th>Killer</th>
|
<th>Killer</th>
|
||||||
<th>Error</th>
|
<th>Error</th>
|
||||||
|
|
|
@ -182,7 +182,12 @@ class Replay {
|
||||||
let tbody = this.results.querySelector("tbody")
|
let tbody = this.results.querySelector("tbody")
|
||||||
tbody.replaceChildren()
|
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 tr = tbody.appendChild(document.createElement("tr"))
|
||||||
|
|
||||||
let tdSwatch = tr.appendChild(document.createElement("td"))
|
let tdSwatch = tr.appendChild(document.createElement("td"))
|
||||||
|
|
Loading…
Reference in New Issue