Fixed bug on search

This commit is contained in:
dbroqua 2019-04-11 19:27:04 +02:00
parent 932b93b9c7
commit e0468e5805

View file

@ -175,18 +175,18 @@ class Vegetables {
return false return false
} }
const _items = items.rows.toJSON()
let vegetables = [] 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 let k = 0
for (k = 0; k < vegetables.length; k += 1) { 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 break
} }
} }
vegetables.splice(k, 0, _items[j]) vegetables.splice(k, 0, item[j])
} }
callback(null, { count: vegetables.length, rows: vegetables }) callback(null, { count: vegetables.length, rows: vegetables })