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

Add years 2013 and 2014 to route idhml

parent 042f0411
No related branches found
No related tags found
1 merge request!116Release v1.0.0
Pipeline #
......@@ -25,14 +25,12 @@ idhmlApp.use(cache('15 day'));
idhmlApp.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) => {
......@@ -47,8 +45,7 @@ idhmlApp.get('/year_range', (req, res, next) => {
idhmlApp.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;
......@@ -56,8 +53,7 @@ idhmlApp.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