Skip to content
Snippets Groups Projects
Commit 5e030fbb authored by Fernando Gbur dos Santos's avatar Fernando Gbur dos Santos
Browse files

Merge branch 'es23-students-receiving-aid-tax' into 'development'

Es23 students receiving aid tax

See merge request !485
parents 9c986bad f7240405
No related branches found
No related tags found
5 merge requests!501[hotfix] capital filter working for superior education conclusion tax...,!499[hotfix] capital filter working for superior education conclusion tax...,!489dev -> hom,!487Development,!485Es23 students receiving aid tax
...@@ -242,7 +242,7 @@ studentsReceivingAidTaxApp.get('/state', (req, res, next) => { ...@@ -242,7 +242,7 @@ studentsReceivingAidTaxApp.get('/state', (req, res, next) => {
next(); next();
}, response('state')); }, response('state'));
studentsReceivingAidTaxApp.get('/age_range', (req, res, next) => { studentsReceivingAidTaxApp.get('/age_range_all', (req, res, next) => {
req.result = [] req.result = []
for (let i = 1; i < 12; i++) { for (let i = 1; i < 12; i++) {
req.result.push({ req.result.push({
...@@ -251,7 +251,7 @@ studentsReceivingAidTaxApp.get('/age_range', (req, res, next) => { ...@@ -251,7 +251,7 @@ studentsReceivingAidTaxApp.get('/age_range', (req, res, next) => {
} }
next(); next();
}, response('age_range')); }, response('age_range_all'));
studentsReceivingAidTaxApp.get('/location', (req, res, next) => { studentsReceivingAidTaxApp.get('/location', (req, res, next) => {
req.result = [] req.result = []
...@@ -578,8 +578,21 @@ function matchQueries(queryPartial, queryTotal) { ...@@ -578,8 +578,21 @@ function matchQueries(queryPartial, queryTotal) {
return match; return match;
} }
function whereCondition(req) {
let where = "";
const dims = req.query.dims;
if (dims && dims.includes("income_range")){
where += `pnad_novo.faixa_rendimento_aux_tx is not null`;
}
return where;
}
studentsReceivingAidTaxApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { studentsReceivingAidTaxApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.querySet = []; req.querySet = [];
let where = whereCondition(req);
// Subquery para total_pop_maior_25 com filtros dinâmicos // Subquery para total_pop_maior_25 com filtros dinâmicos
let totalEstudantesQueRecebemAuxilio = req.sql.clone(); let totalEstudantesQueRecebemAuxilio = req.sql.clone();
...@@ -587,6 +600,7 @@ studentsReceivingAidTaxApp.get('/', rqf.parse(), rqf.build(), (req, res, next) = ...@@ -587,6 +600,7 @@ studentsReceivingAidTaxApp.get('/', rqf.parse(), rqf.build(), (req, res, next) =
.field("ano_ref", "year") .field("ano_ref", "year")
.field("SUM(peso_domicilio_pessoas_com_cal)", "total") .field("SUM(peso_domicilio_pessoas_com_cal)", "total")
.where("recebeu_rendimentos_de_programa_bolsa_familia = 1") .where("recebeu_rendimentos_de_programa_bolsa_familia = 1")
.where(`${where}`)
.where("frequenta_escola = 1") .where("frequenta_escola = 1")
.where("ano_ref >= 2019") .where("ano_ref >= 2019")
.group("ano_ref") .group("ano_ref")
...@@ -598,11 +612,12 @@ studentsReceivingAidTaxApp.get('/', rqf.parse(), rqf.build(), (req, res, next) = ...@@ -598,11 +612,12 @@ studentsReceivingAidTaxApp.get('/', rqf.parse(), rqf.build(), (req, res, next) =
totalEstudantes.from("pnad_novo") totalEstudantes.from("pnad_novo")
.field("ano_ref", "year") .field("ano_ref", "year")
.field("SUM(peso_domicilio_pessoas_com_cal)", "total") .field("SUM(peso_domicilio_pessoas_com_cal)", "total")
.where(`${where}`)
.where("frequenta_escola = 1") .where("frequenta_escola = 1")
.where("ano_ref >= 2019")
.group("ano_ref") .group("ano_ref")
.order("ano_ref"); .order("ano_ref");
req.querySet.push(totalEstudantesQueRecebemAuxilio); req.querySet.push(totalEstudantesQueRecebemAuxilio);
req.querySet.push(totalEstudantes); req.querySet.push(totalEstudantes);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment