diff --git a/middleware/Vegetables.js b/middleware/Vegetables.js index 830c968..f33d98d 100644 --- a/middleware/Vegetables.js +++ b/middleware/Vegetables.js @@ -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) }) }