diff --git a/src/libs/routes/pibpercapita.js b/src/libs/routes/pibpercapita.js index 7d97f837a342060e27a367d3bd811bac92b2263b..21c62920cc4f3b966041cbe72629446a64644dbf 100644 --- a/src/libs/routes/pibpercapita.js +++ b/src/libs/routes/pibpercapita.js @@ -89,22 +89,15 @@ rqf.addField({ pibpercapitaApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { log.debug(req.sql.toParam()); - req.sql.field('(ibge_pib.pib_per_capita)', 'pibpercapita') - .field('ibge_pib.municipio_id', 'municipio_id') - .field('ibge_pib.ano_censo', 'year') - .field('ibge_pib.pib', 'pib') - .field('ibge_populacao.populacao', 'populacao') - .from('ibge_pib') - .join('municipio', null, 'ibge_pib.municipio_id = municipio.id') - .join('ibge_populacao', null, 'ibge_populacao.municipio_id = municipio.id') - .where('ibge_pib.ano_censo = ibge_populacao.ano_censo'); + req.sql.from('ibge_pib') + .field('ibge_pib.pib_per_capita', 'pibpc') + .field('ibge_pib.pib', 'pib') + .field('ibge_pib.populacao', 'population') + .field('ibge_pib.ano_censo', 'year') + // .group('ibge_pib.ano_censo') + .order('ibge_pib.ano_censo') + next(); -}, query, (req, res, next) => { - let somapib = 0; - for (var i = 0; i < req.result.length; i++) { - req.result[i]; - } - next() -}, id2str.transform(true), response('pibpercapita')); +}, query, id2str.transform(true), response('pibpercapita')); module.exports = pibpercapitaApp;