|
|
@ -16,6 +16,8 @@ function populateBoard(){ |
|
|
|
var seconds = date.getSeconds(); |
|
|
|
var minutes = date.getMinutes(); |
|
|
|
var hour = date.getHours(); |
|
|
|
var leaderBoardServerJson = {}; |
|
|
|
leaderBoardServerJson.timeStamp = date.getTime(); |
|
|
|
|
|
|
|
for (var i = rankings.length - 1; i >= 0; i--) { |
|
|
|
if( rankings[i].teamId == 235 ){ |
|
|
@ -23,6 +25,10 @@ function populateBoard(){ |
|
|
|
results += "<p>Updated "+hour+"h "+minutes+"m "+seconds+"s</p>"; |
|
|
|
results += "<h1>Cazziammolla Placement: "+rankings[i].rank+"</h1>"; |
|
|
|
results += "<h2>with a score of: "+rankings[i].score+"</h2>"; |
|
|
|
|
|
|
|
leaderBoardServerJson.placement = rankings[i].rank; |
|
|
|
leaderBoardServerJson.score = rankings[i].score; |
|
|
|
|
|
|
|
if (rankings[i].rank != points && points != 0){ |
|
|
|
ringTheBell(); |
|
|
|
} |
|
|
@ -30,17 +36,24 @@ function populateBoard(){ |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
leaderBoardServerJson.settings = []; |
|
|
|
var settings = data.data.settings; |
|
|
|
for (var i = 0; i < settings.length; i++) { |
|
|
|
for (var j = settings[i].rankings.length - 1; j >= 0; j--) { |
|
|
|
if(settings[i].rankings[j].teamId == 235){ |
|
|
|
results += "<tr><td>"+i+"</td><td>"+settings[i].rankings[j].rank+"</td><td>"+settings[i].rankings[j].score+"</td></tr>" |
|
|
|
leaderBoardServerJson.settings[i] = { rank: settings[i].rankings[j].rank, score: settings[i].rankings[j].score}; |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
var results = "<table><thead><th>Setting</th><th>Placement</th><th>Score</th></thead>"+results+"</table>"; |
|
|
|
listBoard.innerHTML = results; |
|
|
|
try{ |
|
|
|
socket.emit('leaderBoard', JSON.stringify( leaderBoardServerJson)); |
|
|
|
|
|
|
|
}catch(e){ |
|
|
|
console.log("error"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
@ -50,7 +63,6 @@ function updateLeaderBoard(){ |
|
|
|
var intervalID = setInterval( function(){ |
|
|
|
loadRankingJs('https://davar.icfpcontest.org/rankings.js?cachebuster='+ new Date().getTime()); |
|
|
|
}, 30000); |
|
|
|
console.dir(intervalID); |
|
|
|
} |
|
|
|
function loadRankingJs(scriptName) { |
|
|
|
var rankingScript = document.getElementById("rankingScript"); |
|
|
|