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

Fix Filter IDHM level

parent ffe07fd0
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!66Fix Filter IDHM level
Pipeline #
module.exports = function idhmLevel(id) {
switch (id) {
case 1:
return 'Muito Baixa';
case 2:
return 'Baixo';
case 3:
return 'Médio';
case 4:
return 'Alto';
case 5:
return 'Muito Alto';
default:
return 'Não classificado';
}
};
...@@ -14,6 +14,7 @@ const educationLevelShort = require(`${libs}/convert/educationLevelShort`); ...@@ -14,6 +14,7 @@ const educationLevelShort = require(`${libs}/convert/educationLevelShort`);
const educationType = require(`${libs}/convert/educationType`); const educationType = require(`${libs}/convert/educationType`);
const citySize = require(`${libs}/convert/citySize`); const citySize = require(`${libs}/convert/citySize`);
const incomeLevel = require(`${libs}/convert/incomeLevel`); const incomeLevel = require(`${libs}/convert/incomeLevel`);
const idhmLevel = require(`${libs}/convert/idhmLevel`);
const ids = { const ids = {
gender_id: gender, gender_id: gender,
...@@ -60,7 +61,8 @@ const ids = { ...@@ -60,7 +61,8 @@ const ids = {
water_id: booleanVariable, water_id: booleanVariable,
education_type_id: educationType, education_type_id: educationType,
income_level_id: incomeLevel, income_level_id: incomeLevel,
city_size_id: citySize city_size_id: citySize,
idhm_level_id: idhmLevel
}; };
function transform(removeId=false) { function transform(removeId=false) {
......
...@@ -116,10 +116,10 @@ rqf.addField({ ...@@ -116,10 +116,10 @@ rqf.addField({
field: 'ano_censo' field: 'ano_censo'
} }
}).addValue({ }).addValue({
name: 'IDHM_level', name: 'idhm_level',
table: '@', table: '@',
tableField: 'idhm_nivel', tableField: 'idhm_nivel',
resultField: 'idhm_nivel_id', resultField: 'idhm_level_id',
where: { where: {
relation: '=', relation: '=',
type: 'integer', type: 'integer',
...@@ -163,6 +163,6 @@ idhmApp.get('/', rqf.parse(), (req, res, next) => { ...@@ -163,6 +163,6 @@ idhmApp.get('/', rqf.parse(), (req, res, next) => {
}); });
} }
next(); next();
}, rqf.build(),query, response('idhm')); }, rqf.build(), query, id2str.transform(), response('idhm'));
module.exports = idhmApp; module.exports = idhmApp;
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