Skip to content
Snippets Groups Projects
Commit 446d05e0 authored by es23's avatar es23 :coffee:
Browse files

fix - nao e capital

parent 3bfa107e
No related branches found
No related tags found
4 merge requests!501[hotfix] capital filter working for superior education conclusion tax...,!499[hotfix] capital filter working for superior education conclusion tax...,!476dev -> homologa,!475FIX - superior education conclusion tax
......@@ -163,7 +163,7 @@ const aggregateClass = require(`${libs}/routes_v1/aggregateClass`);
const instructionLevel = require(`${libs}/routes_v1/instructionLevel`);
const uniLocalOfferAggregate = require(`${libs}/routes_v1/uniLocalOfferAggregate`)
//const uniLocalOfferAggregate = require(`${libs}/routes_v1/uniLocalOfferAggregate`)
const basicEducationConclusion = require(`${libs}/routes_v1/basicEducationConclusion`);
......
......@@ -111,7 +111,7 @@ superiorEducationConclusionTaxApp.get('/region', (req, res, next) => {
next();
}, response('region'));
superiorEducationConclusionTaxApp.get('/cap_code', (req, res, next) => {
superiorEducationConclusionTaxApp.get('/cap_code_pnad', (req, res, next) => {
req.result = []
for (let i = 11; i < 54; i++) {
if (id2str.capitalCode(i) !== 'Não informado') {
......@@ -120,10 +120,8 @@ superiorEducationConclusionTaxApp.get('/cap_code', (req, res, next) => {
});
}
}
req.result.push({id: 99, name: id2str.capitalCode(99)});
next();
}, response('cap_code'));
}, response('cap_code_pnad'));
superiorEducationConclusionTaxApp.get('/metro_code', (req, res, next) => {
req.result = []
......@@ -134,7 +132,6 @@ superiorEducationConclusionTaxApp.get('/metro_code', (req, res, next) => {
});
}
}
req.result.push({id: 99, name: id2str.metroCode(99)});
next();
}, response('metro_code'));
......@@ -444,10 +441,10 @@ rqf.addField({
field: 'sexo'
}
}).addValue({
name: 'cap_code',
name: 'cap_code_pnad',
table: 'pnad_novo',
tableField: 'cod_cap',
resultField: 'cap_code_id',
resultField: 'cap_code_pnad_id',
where: {
relation: '=',
type: 'integer',
......@@ -575,8 +572,29 @@ function matchQueries(queryPartial, queryTotal) {
return match;
}
function whereCondition(req) {
let where = "";
let filterId;
//const filters = req.query.filter.split(",");
const dims = req.query.dims;
if (dims && dims.includes("cap_code_pnad")){
where += `pnad_novo.cod_cap <> 99`;
}
console.log(where);
//dims.forEach((dim) => {
//if (dim.includes("cod_cap")) {
//filterId = dim.split(":")[1];
//where += `pnad_novo.cod_cap != 99`;
//}
//});
return where;
}
superiorEducationConclusionTaxApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.querySet = [];
let where = whereCondition(req);
// Subquery para total_pop_maior_25 com filtros dinâmicos
let totalPopMaior25ComSuperiorCompleto = req.sql.clone();
......@@ -586,6 +604,7 @@ superiorEducationConclusionTaxApp.get('/', rqf.parse(), rqf.build(), (req, res,
.where("idade_morador_31_03 >= 25")
.where("nivel_de_instruc_mais_elevad_para_o_fundam_com_duracao_9_anos = 7")
.where("ano_ref >= 2019")
.where(`${where}`)
.group("ano_ref")
.order("ano_ref");
......@@ -597,14 +616,10 @@ superiorEducationConclusionTaxApp.get('/', rqf.parse(), rqf.build(), (req, res,
.field("SUM(peso_domicilio_pessoas_com_cal)", "total")
.where("idade_morador_31_03 >= 25")
.where("ano_ref >= 2019")
.where(`${where}`)
.group("ano_ref")
.order("ano_ref");
// if (req.query.dims && req.query.dims.includes("income_range")) {
// totalPopMaior19.where("faixa_rendimento_aux_tx is not null");
// totalPopEdBasMaior19.where("faixa_rendimento_aux_tx is not null");
// }
req.querySet.push(totalPopMaior25ComSuperiorCompleto);
req.querySet.push(totalPopMaior25);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment