From 1cb94329223ac63c47d83e2c3973941ead19b512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Mon, 26 Mar 2018 11:43:17 +0200 Subject: [PATCH] Credit insurance validations fix --- services/client/common/models/credit-insurance.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/services/client/common/models/credit-insurance.js b/services/client/common/models/credit-insurance.js index 95902ab9c..155d4de44 100644 --- a/services/client/common/models/credit-insurance.js +++ b/services/client/common/models/credit-insurance.js @@ -1,22 +1,22 @@ module.exports = function(Self) { require('../methods/creditInsurance/filter.js')(Self); + Self.validateCredit = function(credit) { + return credit >= 0; + }; + Self.validateBinded('credit', Self.validateCredit, { message: 'The credit must be an integer greater than or equal to zero', allowNull: false, // FIXME: Ignored by loopback when it's false allowBlank: false }); - Self.validateCredit = function(credit) { - return (credit >= 0 && credit % 1 == 0); + Self.validateGrade = function(grade) { + return typeof grade === 'undefined' || grade >= 0; }; Self.validateBinded('grade', Self.validateGrade, { message: 'The grade must be an integer greater than or equal to zero', allowNull: true }); - - Self.validateGrade = function(grade) { - return (typeof grade === 'undefined' || (grade >= 0 && grade % 1 == 0)); - }; };