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()
|
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 (item[j].name.localeCompare(vegetables[k].name) === -1) {
|
if (item.name.localeCompare(vegetables[k].name) === -1) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vegetables.splice(k, 0, item[j])
|
vegetables.splice(k, 0, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(null, { count: vegetables.length, rows: vegetables })
|
callback(null, { count: vegetables.length, rows: vegetables })
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
console.log('ERR:', e)
|
||||||
callback(e, null)
|
callback(e, null)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue