Skip to content
Snippets Groups Projects
Commit 35aa14f6 authored by Fernando Erd's avatar Fernando Erd :ok_hand:
Browse files

Fix error where city in filter

parent 446f9001
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!64Fix error where city in filter
Pipeline #
......@@ -74,12 +74,12 @@ rqf.addField({
relation: '=',
type: 'integer',
field: 'estado_id',
table: 'adh_idh_uf'
table: '@'
},
join: {
primary: 'id',
foreign: 'estado_id',
foreignTable: 'adh_idh_uf'
foreignTable: '@'
}
}).addValue({
name: 'min_year',
......@@ -114,7 +114,7 @@ idhmrApp.get('/', rqf.parse(), (req, res, next) => {
message: 'Wrong/No filter specified'
});
}
if ("state" in req.filter) {
if ("state" in req.filter && !("city" in req.filter)) {
req.sql.from('adh_idh_uf')
.field('adh_idh_uf.idhm_r', 'total')
.field('adh_idh_uf.ano_censo', 'year')
......@@ -123,7 +123,8 @@ idhmrApp.get('/', rqf.parse(), (req, res, next) => {
req.sql.from('adh_idh')
.field('adh_idh.idhm_r', 'total')
.field('adh_idh.ano_censo', 'year')
.field('adh_idh.municipio_id', 'city_id');
.field('adh_idh.municipio_id', 'city_id')
.field('adh_idh.estado_id', 'estado_id');
} else {
next({
status: 400,
......
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