Fixed bug on search
This commit is contained in:
parent
932b93b9c7
commit
e0468e5805
1 changed files with 4 additions and 4 deletions
|
@ -175,18 +175,18 @@ class Vegetables {
|
|||
return false
|
||||
}
|
||||
|
||||
const _items = items.rows.toJSON()
|
||||
let vegetables = []
|
||||
|
||||
for (let j = 0; j < _items.length; j += 1) {
|
||||
for (let j = 0; j < items.rows.length; j += 1) {
|
||||
const item = items.rows[j].toJSON()
|
||||
let k = 0
|
||||
for (k = 0; k < vegetables.length; k += 1) {
|
||||
if (_items[j].name.localeCompare(vegetables[k].name) === -1) {
|
||||
if (item[j].name.localeCompare(vegetables[k].name) === -1) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
vegetables.splice(k, 0, _items[j])
|
||||
vegetables.splice(k, 0, item[j])
|
||||
}
|
||||
|
||||
callback(null, { count: vegetables.length, rows: vegetables })
|
||||
|
|
Loading…
Reference in a new issue