Skip to content
Snippets Groups Projects
Commit 26ccfb7f authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

Add years 2013 and 2014 to route idhm

parent d2b8d478
No related branches found
No related tags found
1 merge request!116Release v1.0.0
Pipeline #
......@@ -27,14 +27,12 @@ idhmApp.use(cache('15 day'));
idhmApp.get('/year_range', (req, res, next) => {
req.sql.from('adh_idh')
.field('MIN(adh_idh.ano_censo)', 'start_year')
.field('MAX(adh_idh.ano_censo)', 'end_year')
.where('adh_idh.ano_censo <> 2014 AND adh_idh.ano_censo <> 2013');
.field('MAX(adh_idh.ano_censo)', 'end_year');
next();
}, query, (req, res, next) => {
req.sql.from('adh_idh_uf')
.field('MIN(adh_idh_uf.ano_censo)', 'start_year')
.field('MAX(adh_idh_uf.ano_censo)', 'end_year')
.where('adh_idh_uf.ano_censo <> 2014 AND adh_idh_uf.ano_censo <> 2013');
.field('MAX(adh_idh_uf.ano_censo)', 'end_year');
req.old_result = req.result;
next();
}, query, (req, res, next) => {
......@@ -49,8 +47,7 @@ idhmApp.get('/year_range', (req, res, next) => {
idhmApp.get('/years', (req, res, next) => {
req.sql.from('adh_idh')
.field('DISTINCT adh_idh.ano_censo', 'year')
.where('adh_idh.ano_censo <> 2014 AND adh_idh.ano_censo <> 2013');
.field('DISTINCT adh_idh.ano_censo', 'year');
next();
}, query, (req, res, next) => {
req.oldResult = req.result;
......@@ -58,8 +55,7 @@ idhmApp.get('/years', (req, res, next) => {
req.sql = squel.select();
req.sql.from('adh_idh_uf')
.field('DISTINCT adh_idh_uf.ano_censo', 'year')
.where('adh_idh_uf.ano_censo <> 2014 AND adh_idh_uf.ano_censo <> 2013');
.field('DISTINCT adh_idh_uf.ano_censo', 'year');
next();
}, query, (req, res, next) => {
let result = Object.assign(req.oldResult, req.result);
......
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