From 723cf9bede39af751933fd057a5c48674f9ea276 Mon Sep 17 00:00:00 2001 From: Gabriel Ruschel <grc15@inf.ufpr.br> Date: Thu, 3 Aug 2017 09:35:58 -0300 Subject: [PATCH] Fix idhme and idhml filters and dims checks --- src/libs/routes/idhme.js | 16 ++++++++-------- src/libs/routes/idhml.js | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/libs/routes/idhme.js b/src/libs/routes/idhme.js index 5ce84d93..691f188c 100644 --- a/src/libs/routes/idhme.js +++ b/src/libs/routes/idhme.js @@ -123,13 +123,13 @@ rqf.addField({ idhmeApp.get('/', rqf.parse(), (req, res, next) => { - if(typeof req.filter === 'undefined' || Object.keys(req.filter).length === 0) { - res.status(400); - next({ - status: 400, - message: 'Wrong/No filter specified' - }); - } + // if(typeof req.filter === 'undefined' || Object.keys(req.filter).length === 0) { + // res.status(400); + // next({ + // status: 400, + // message: 'Wrong/No filter specified' + // }); + // } if (("city" in req.dims) || ("city" in req.filter)) { req.sql.from('adh_idh') @@ -139,7 +139,7 @@ idhmeApp.get('/', rqf.parse(), (req, res, next) => { .group('adh_idh.idhm_e') .group('adh_idh.ano_censo') .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') .field('adh_idh_uf.idhm_e', 'total') .field('adh_idh_uf.ano_censo', 'year') diff --git a/src/libs/routes/idhml.js b/src/libs/routes/idhml.js index eb39779d..ddd7af6b 100644 --- a/src/libs/routes/idhml.js +++ b/src/libs/routes/idhml.js @@ -122,13 +122,13 @@ rqf.addField({ }); idhmlApp.get('/', rqf.parse(), (req, res, next) => { - if(typeof req.filter === 'undefined' || Object.keys(req.filter).length === 0) { - res.status(400); - next({ - status: 400, - message: 'Wrong/No filter specified' - }); - } + // if(typeof req.filter === 'undefined' || Object.keys(req.filter).length === 0) { + // res.status(400); + // next({ + // status: 400, + // message: 'Wrong/No filter specified' + // }); + // } if (("city" in req.dims) || ("city" in req.filter)) { req.sql.from('adh_idh') @@ -138,7 +138,7 @@ idhmlApp.get('/', rqf.parse(), (req, res, next) => { .group('adh_idh.idhm_l') .group('adh_idh.ano_censo') .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') .field('adh_idh_uf.idhm_l', 'total') .field('adh_idh_uf.ano_censo', 'year') -- GitLab