diff --git a/static/leaderboard.json b/static/leaderboard.json index 0da1377..b845fad 100644 --- a/static/leaderboard.json +++ b/static/leaderboard.json @@ -1,45 +1,41 @@ -{ - "title": "Pusan", - "items": [ - { - "name": "Racer", - "time": "00:12.345" - }, - { - "name": "Racer", - "time": "00:13.654" - }, - { - "name": "Racer", - "time": "00:10.357" - }, - { - "name": "Racer", - "time": "00:10.742" - }, - { - "name": "Racer", - "time": "00:09.367" - }, - { - "name": "Racer", - "time": "00:10.135" - }, - { - "name": "Racer", - "time": "00:10.456" - }, - { - "name": "Racer", - "time": "00:11.726" - }, - { - "name": "Racer", - "time": "00:12.538" - }, - { - "name": "Racer", - "time": "00:10.922" - } - ] -} +[{ + "racerName": "Racer", + "lapTime": "00:12.345" + }, + { + "racerName": "Racer", + "lapTime": "00:13.654" + }, + { + "racerName": "Racer", + "lapTime": "00:10.357" + }, + { + "racerName": "Racer", + "lapTime": "00:10.742" + }, + { + "racerName": "Racer", + "lapTime": "00:09.367" + }, + { + "racerName": "Racer", + "lapTime": "00:10.135" + }, + { + "racerName": "Racer", + "lapTime": "00:10.456" + }, + { + "racerName": "Racer", + "lapTime": "00:11.726" + }, + { + "racerName": "Racer", + "lapTime": "00:12.538" + }, + { + "racerName": "Racer", + "lapTime": "00:10.922" + } +] diff --git a/static/league.js b/static/league.js index 5282a89..27592a5 100644 --- a/static/league.js +++ b/static/league.js @@ -39,13 +39,13 @@ function print(res) { let pos = 0; items.forEach(function (item) { pos++; - addRow('lb-row', pos, item.name, item.time); + addRow('lb-row', pos, item.racerName, item.lapTime); }); } function compare(a, b) { - a2 = sec(a.time); - b2 = sec(b.time); + a2 = sec(a.lapTime); + b2 = sec(b.lapTime); if (a2 < b2) { return -1; } else if (a2 > b2) { @@ -59,12 +59,12 @@ function sec(t) { return ((+a[0]) * 60) + (+a[1]); } -function addRow(className, position, name, time) { +function addRow(className, position, racerName, lapTime) { let row = document.createElement('div'); row.classList.add(className); addText(row, position); - addText(row, name); - addText(row, time); + addText(row, racerName); + addText(row, lapTime); lb_items.appendChild(row); }