Fixed ASC
This commit is contained in:
parent
38aff94e26
commit
0134087eee
1 changed files with 18 additions and 1 deletions
|
@ -77,7 +77,24 @@ class VegetableTypes {
|
|||
callback(new Error('Item vegetable type not found'), 404)
|
||||
return false
|
||||
}
|
||||
callback(null, item)
|
||||
|
||||
let type = item.toJSON()
|
||||
let vegetables = []
|
||||
|
||||
for (let j = 0; j < type.Vegetables.length; j += 1) {
|
||||
let k = 0
|
||||
for (k = 0; k < vegetables.length; k += 1) {
|
||||
if (type.Vegetables[j].name < vegetables[k].name) {
|
||||
console.log('Break at:', k)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
vegetables.splice(k, 0, type.Vegetables[j])
|
||||
}
|
||||
type.Vegetables = vegetables
|
||||
|
||||
callback(null, type)
|
||||
})
|
||||
.catch((e) => {
|
||||
callback(e, null)
|
||||
|
|
Loading…
Reference in a new issue