From 38aff94e261c2bdff039bc6dfb228fca2792c533 Mon Sep 17 00:00:00 2001 From: dbroqua Date: Thu, 11 Apr 2019 13:17:39 +0200 Subject: [PATCH] Fixed bug --- middleware/VegetableTypes.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/middleware/VegetableTypes.js b/middleware/VegetableTypes.js index 9698bbf..f09a7ae 100644 --- a/middleware/VegetableTypes.js +++ b/middleware/VegetableTypes.js @@ -2,7 +2,7 @@ const models = require('../models') const vegetableTypes = models.vegetableTypes class VegetableTypes { - static getAll(req, callback) { + static getAll (req, callback) { vegetableTypes.findAndCountAll({ order: [ ['name', 'ASC'] @@ -30,7 +30,7 @@ class VegetableTypes { for (let j = 0; j < type.Vegetables.length; j += 1) { let k = 0 for (k = 0; k < vegetables.length; k += 1) { - if (type.Vegetables[j].name < vegetables[k]) { + if (type.Vegetables[j].name < vegetables[k].name) { console.log('Break at:', k) break } @@ -50,7 +50,7 @@ class VegetableTypes { }) } - createOne(req, callback) { + createOne (req, callback) { vegetableTypes.create(req.body) .then(item => { callback(null, item) @@ -60,7 +60,7 @@ class VegetableTypes { }) } - static getOne(req, callback) { + static getOne (req, callback) { vegetableTypes.findById( req.params.vegetableTypesId, { @@ -84,7 +84,7 @@ class VegetableTypes { }) } - patchOne(req, callback) { + patchOne (req, callback) { VegetableTypes.getOne(req, (err, item) => { if (err) { callback(err, item) @@ -101,7 +101,7 @@ class VegetableTypes { }) } - deleteOne(req, callback) { + deleteOne (req, callback) { VegetableTypes.getOne(req, (err, item) => { if (err) { callback(err, item)