fix challenge ordering

Now challenges are ordered on map first by top order value of json file
second by index of array
This commit is contained in:
Berkeley Martinez
2015-08-10 23:29:32 -07:00
parent 43e3dc8914
commit 5f21db457d
3 changed files with 9 additions and 2 deletions

View File

@ -22,6 +22,9 @@
"order": {
"type": "number"
},
"suborder": {
"type": "number"
},
"dashedName": {
"type": "string"
},

View File

@ -63,7 +63,8 @@ Challenge.destroyAll(function(err, info) {
.toLowerCase()
.replace(/\:/g, '')
.replace(/\s/g, '-');
challenge.order = +('' + order + (index + 1));
challenge.order = order;
challenge.suborder = index + 1;
challenge.block = block;
return challenge;

View File

@ -458,7 +458,10 @@ module.exports = function(app) {
.map(camperCount => numberWithCommas(camperCount));
const query = {
order: 'order ASC'
order: [
'order ASC',
'suborder ASC'
]
};
// create a stream of all the challenges