Skip to content
Snippets Groups Projects
Commit 723cf9be authored by Gabriel Ruschel's avatar Gabriel Ruschel
Browse files

Fix idhme and idhml filters and dims checks

parent 042fc263
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!71Idhme idhml hotfix
...@@ -123,13 +123,13 @@ rqf.addField({ ...@@ -123,13 +123,13 @@ rqf.addField({
idhmeApp.get('/', rqf.parse(), (req, res, next) => { idhmeApp.get('/', rqf.parse(), (req, res, next) => {
if(typeof req.filter === 'undefined' || Object.keys(req.filter).length === 0) { // if(typeof req.filter === 'undefined' || Object.keys(req.filter).length === 0) {
res.status(400); // res.status(400);
next({ // next({
status: 400, // status: 400,
message: 'Wrong/No filter specified' // message: 'Wrong/No filter specified'
}); // });
} // }
if (("city" in req.dims) || ("city" in req.filter)) { if (("city" in req.dims) || ("city" in req.filter)) {
req.sql.from('adh_idh') req.sql.from('adh_idh')
...@@ -139,7 +139,7 @@ idhmeApp.get('/', rqf.parse(), (req, res, next) => { ...@@ -139,7 +139,7 @@ idhmeApp.get('/', rqf.parse(), (req, res, next) => {
.group('adh_idh.idhm_e') .group('adh_idh.idhm_e')
.group('adh_idh.ano_censo') .group('adh_idh.ano_censo')
.group('adh_idh.municipio_id'); .group('adh_idh.municipio_id');
} else if (("state" in req.filter) || ("state" in req.dims) && !("city" in req.filter) && !("city" in req.dims)) { } else if (("state" in req.filter) || ("state" in req.dims)) {
req.sql.from('adh_idh_uf') req.sql.from('adh_idh_uf')
.field('adh_idh_uf.idhm_e', 'total') .field('adh_idh_uf.idhm_e', 'total')
.field('adh_idh_uf.ano_censo', 'year') .field('adh_idh_uf.ano_censo', 'year')
......
...@@ -122,13 +122,13 @@ rqf.addField({ ...@@ -122,13 +122,13 @@ rqf.addField({
}); });
idhmlApp.get('/', rqf.parse(), (req, res, next) => { idhmlApp.get('/', rqf.parse(), (req, res, next) => {
if(typeof req.filter === 'undefined' || Object.keys(req.filter).length === 0) { // if(typeof req.filter === 'undefined' || Object.keys(req.filter).length === 0) {
res.status(400); // res.status(400);
next({ // next({
status: 400, // status: 400,
message: 'Wrong/No filter specified' // message: 'Wrong/No filter specified'
}); // });
} // }
if (("city" in req.dims) || ("city" in req.filter)) { if (("city" in req.dims) || ("city" in req.filter)) {
req.sql.from('adh_idh') req.sql.from('adh_idh')
...@@ -138,7 +138,7 @@ idhmlApp.get('/', rqf.parse(), (req, res, next) => { ...@@ -138,7 +138,7 @@ idhmlApp.get('/', rqf.parse(), (req, res, next) => {
.group('adh_idh.idhm_l') .group('adh_idh.idhm_l')
.group('adh_idh.ano_censo') .group('adh_idh.ano_censo')
.group('adh_idh.municipio_id'); .group('adh_idh.municipio_id');
} else if (("state" in req.filter) || ("state" in req.dims) && !("city" in req.filter) && !("city" in req.dims)) { } else if (("state" in req.filter) || ("state" in req.dims)) {
req.sql.from('adh_idh_uf') req.sql.from('adh_idh_uf')
.field('adh_idh_uf.idhm_l', 'total') .field('adh_idh_uf.idhm_l', 'total')
.field('adh_idh_uf.ano_censo', 'year') .field('adh_idh_uf.ano_censo', 'year')
......
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