Skip to content
Snippets Groups Projects
Commit 5f8dd801 authored by Fernando Erd's avatar Fernando Erd :ok_hand:
Browse files

Round Pib Per Capita

parent ba46cebb
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!83Round Pib Per Capita
Pipeline #
......@@ -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;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment