Fixed bug on search
This commit is contained in:
parent
e0468e5805
commit
c121746380
1 changed files with 3 additions and 2 deletions
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue