diff --git a/src/libs/routes/pibpercapita.js b/src/libs/routes/pibpercapita.js index b0ef35cca62722e1b72322d5a5658a1a866d937e..5fd9bd7910bcc2bc92a46619112ed91ba98e5a9e 100644 --- a/src/libs/routes/pibpercapita.js +++ b/src/libs/routes/pibpercapita.js @@ -163,6 +163,21 @@ pibpercapitaApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { .order('ibge_pib.ano_censo') } next(); -}, rqf.build(), query, id2str.transform(false), response('pibpercapita')); +}, query, id2str.transform(false), (req, res, next) => { + req.result.forEach((i) => { + let value = i.total; + let res = value.toString().split("."); + //rounding decimal. + let decimal = Math.round(res[1].toString().substring(0,2) + (".") + res[1].toString().substring(2,3)); + //case 0 after comma + if (res[1].toString().substring(0,1) == 0) { + i.total = parseFloat(res[0] + "." + "0" + decimal); + } else { + i.total = parseFloat(res[0] + "." + decimal); + } + }); + next(); + } ,response("pibpercapita")); + module.exports = pibpercapitaApp;