mirror of https://github.com/JohnHammond/CTFd.git
Closes #169
Changed the /chals/colves endpoint and associated javascript to index solves by challenge id rather than by challenge name Closes (#169)selenium-screenshot-testing
parent
4f4d6cae22
commit
22f57751e0
|
@ -74,7 +74,7 @@ def chals_per_solves():
|
|||
.join(Challenges, solves_sub.columns.chalid == Challenges.id).all()
|
||||
json = {}
|
||||
for chal, count, name in solves:
|
||||
json[name] = count
|
||||
json[chal] = count
|
||||
db.session.close()
|
||||
return jsonify(json)
|
||||
|
||||
|
|
|
@ -136,13 +136,13 @@ function marksolves(cb) {
|
|||
function updatesolves(cb){
|
||||
$.get(script_root + '/chals/solves', function (data) {
|
||||
var solves = $.parseJSON(JSON.stringify(data));
|
||||
var chals = Object.keys(solves);
|
||||
var chalids = Object.keys(solves);
|
||||
|
||||
for (var i = 0; i < chals.length; i++) {
|
||||
for (var i = 0; i < chalids.length; i++) {
|
||||
var obj = $.grep(challenges['game'], function (e) {
|
||||
return e.name == chals[i];
|
||||
return e.id == chalids[i];
|
||||
})[0];
|
||||
obj.solves = solves[chals[i]]
|
||||
obj.solves = solves[chalids[i]]
|
||||
};
|
||||
if (cb) {
|
||||
cb();
|
||||
|
|
Loading…
Reference in New Issue