Skip to content
Snippets Groups Projects
Commit 2831b72d authored by Lucas Gabriel Lima's avatar Lucas Gabriel Lima
Browse files

return state and region id

parent 9a6bb2b6
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!58Pib per capita e População
Pipeline #
...@@ -105,8 +105,11 @@ rqf.addField({ ...@@ -105,8 +105,11 @@ rqf.addField({
populationApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { populationApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
log.debug(req.sql.toParam()); log.debug(req.sql.toParam());
log.debug(req.dims);
req.sql.field('ibge_populacao.populacao', 'population') req.sql.field('ibge_populacao.populacao', 'population')
.field('ibge_populacao.municipio_id', 'municipio_id') .field('ibge_populacao.municipio_id', 'city_id')
.field('ibge_populacao.estado_id', 'state_id')
.field('ibge_populacao.regiao_id', 'region_id')
.field('ibge_populacao.ano_censo', 'year') .field('ibge_populacao.ano_censo', 'year')
.from('ibge_populacao') .from('ibge_populacao')
.group('ibge_populacao.populacao') .group('ibge_populacao.populacao')
...@@ -114,11 +117,11 @@ populationApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { ...@@ -114,11 +117,11 @@ populationApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
.group('ibge_populacao.ano_censo') .group('ibge_populacao.ano_censo')
next(); next();
}, query, (req, res, next) => { }, query, (req, res, next) => {
// let somapop = 0; let somapop = 0;
// for (var i = 0; i < req.result.length; i++) { for (var i = 0; i < req.result.length; i++) {
// somapop += req.result[i].population; somapop += req.result[i].population;
// } }
//
// req.result = [{population: somapop, year: req.result[0].year}]; // req.result = [{population: somapop, year: req.result[0].year}];
next() next()
}, id2str.transform(true), response('population')); }, id2str.transform(true), response('population'));
......
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