Commit 21f6eeef authored by Vytor Calixto's avatar Vytor Calixto 👾

🐛 Fix bug in pibpercapita route

parent ee557166
Pipeline #15234 failed with stage
in 60 minutes and 4 seconds
......@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## 1.0.2 - 2018-04-18
### Changed
- Fixed bug in pibpercapita route
## 1.0.1 - 2018-03-15
### Changed
- Fix missing school id in teacher and class routes
......
......@@ -86,8 +86,8 @@ rqf.addField({
}).addValue({
name: 'state',
table: 'estado',
tableField: 'nome',
resultField: 'state_name',
tableField: ['nome', 'id'],
resultField: ['state_name', 'state_id'],
where: {
relation: '=',
type: 'integer',
......@@ -163,21 +163,23 @@ pibpercapitaApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
.order('ibge_pib.ano_censo')
}
next();
}, query, addMissing(rqf), id2str.transform(false), (req, res, next) => {
}, query, (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);
}
let value = i.total;
console.log(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);
}
console.log(i.total);
});
next();
}, response("pibpercapita"));
}, addMissing(rqf), id2str.transform(false), response("pibpercapita"));
module.exports = pibpercapitaApp;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment