Fixing challenge ordering bug introduced (#385)

selenium-screenshot-testing
Kevin Chung 2017-09-13 02:18:00 -04:00 committed by GitHub
parent 50ad759a19
commit 3a8a7e5dd0
1 changed files with 8 additions and 10 deletions

View File

@ -168,15 +168,17 @@ function updatesolves(cb){
var chalids = Object.keys(solves);
for (var i = 0; i < chalids.length; i++) {
for (var i = 0; i < challenges['game'].length; i++) {
var obj = challenges['game'][i];
for (var z = 0; z < challenges['game'].length; z++) {
var obj = challenges['game'][z];
var solve_cnt = solves[chalids[i]];
if (obj.id == chalids[i]){
if (solve_cnt) {
obj.solves = solve_cnt;
} else {
obj.solves = 0;
}
}
}
};
if (cb) {
cb();
@ -203,10 +205,6 @@ function loadchals(cb) {
var categories = [];
challenges = $.parseJSON(JSON.stringify(data));
challenges['game'].sort(function(a, b) {
return a.id - b.id || a.name.localeCompare(b.name);
});
$('#challenges-board').html("");
for (var i = challenges['game'].length - 1; i >= 0; i--) {