diff --git a/app/controllers/creditpd.controller.js b/app/controllers/creditpd.controller.js index 7b0e92b..7c1508d 100644 --- a/app/controllers/creditpd.controller.js +++ b/app/controllers/creditpd.controller.js @@ -79,7 +79,7 @@ exports.PullCreditPdData = async (req, res) => { console.log(tableName); await tableName.create(element) .then((successData)=>{logMsg.info(tableName+" insert success ,PdId= "+successData.dataValues.pd_id);}) - .catch((err)=>{ logMsg.info(tableName+" insert failed ,PdId = "+PDID.dataValues.pd_id+ " ERR =" + err); }); + .catch((err)=>{ logMsg.info(tableName+" insert failed ,PdId = "+PDID.dataValues.pd_id+ " ERR =" + err ); }); }); } diff --git a/app/services/CreditPdHelper.js b/app/services/CreditPdHelper.js index ed28f90..02fe6aa 100644 --- a/app/services/CreditPdHelper.js +++ b/app/services/CreditPdHelper.js @@ -89,11 +89,22 @@ async function ARRAY(Array , GenInfoObj , OverallKey) { if (typeof Value === "object" && ( Value !== null )) { Obj = await OBJECT( element, Key , Value ); Object.assign(ArrayObj, Obj ) - if (OverallKey == "Borrower & Guarantor Details" && Key == "borrower_name" && element.borrower_type == "Main Applicant") { Object.assign(GenInfoObj,{name : element.borrower_name}); } + if (OverallKey == "Borrower & Guarantor Details" && Key == "borrower_name" && element.borrower_type == "Main Applicant") { Object.assign(GenInfoObj,{name : element.borrower_name}); } } else { Object.assign(ArrayObj,{ [Key] : Value }) if (OverallKey == "Borrower & Guarantor Details" && Key == "borrower_name" && element.borrower_type == "Main Applicant") { Object.assign(GenInfoObj,{name : element.borrower_name}); } } + if (OverallKey == "Borrower & Guarantor Details" && Key == "numbers_of_years_business_running" ) + { + + if(typeof element.numbers_of_years_business_running === 'number') + { + + //RoundOfValue = Math.round(element.numbers_of_years_business_running,2).toString(); + RoundOfValue = Number((element.numbers_of_years_business_running).toFixed(2).toString()); + Object.assign(ArrayObj,{ numbers_of_years_business_running : RoundOfValue }); + } + } } tempArr.push(ArrayObj) ArrayObj = { };