Fixed bug on search

This commit is contained in:
dbroqua 2019-04-11 19:31:31 +02:00
parent e0468e5805
commit c121746380

View file

@ -181,17 +181,18 @@ class Vegetables {
const item = items.rows[j].toJSON()
let k = 0
for (k = 0; k < vegetables.length; k += 1) {
if (item[j].name.localeCompare(vegetables[k].name) === -1) {
if (item.name.localeCompare(vegetables[k].name) === -1) {
break
}
}
vegetables.splice(k, 0, item[j])
vegetables.splice(k, 0, item)
}
callback(null, { count: vegetables.length, rows: vegetables })
})
.catch((e) => {
console.log('ERR:', e)
callback(e, null)
})
}