Commit c67cb80b authored by Fernando Erd's avatar Fernando Erd 👌

Merge branch 'hotfix_gloss_enrollment' into v1.1.1

parents b989f5a4 53b2bf84
Pipeline #15591 failed with stage
in 60 minutes and 4 seconds
...@@ -298,7 +298,13 @@ glossEnrollmentRatioApp.get('/', rqf.parse(),(req, res, next) => { ...@@ -298,7 +298,13 @@ glossEnrollmentRatioApp.get('/', rqf.parse(),(req, res, next) => {
.field('matricula.ano_censo', 'year') .field('matricula.ano_censo', 'year')
.group('matricula.ano_censo') .group('matricula.ano_censo')
.order('matricula.ano_censo') .order('matricula.ano_censo')
.where('matricula.tipo <= 3')
if ( "education_level_basic" in req.dims ) {
req.sql.field('matricula.etapas_mod_ensino_segmento_id', 'age_range')
req.sql.where('matricula.etapas_mod_ensino_segmento_id = 1 OR matricula.etapas_mod_ensino_segmento_id = 2 OR matricula.etapas_mod_ensino_segmento_id = 4 OR matricula.etapas_mod_ensino_segmento_id = 5 OR matricula.etapas_mod_ensino_segmento_id = 6')
req.sql.group('matricula.etapas_mod_ensino_segmento_id', 'age_range');
}
next(); next();
}, rqf.build(), query, id2str.transform(), (req, res, next) => { }, rqf.build(), query, id2str.transform(), (req, res, next) => {
req.numerator = req.result; req.numerator = req.result;
...@@ -332,9 +338,13 @@ glossEnrollmentRatioApp.get('/', rqf.parse(),(req, res, next) => { ...@@ -332,9 +338,13 @@ glossEnrollmentRatioApp.get('/', rqf.parse(),(req, res, next) => {
} }
string_query = string_query + convert(req.filter.education_level_basic[req.filter.education_level_basic.length - 1]); string_query = string_query + convert(req.filter.education_level_basic[req.filter.education_level_basic.length - 1]);
req.sql.where(string_query); req.sql.where(string_query);
} else { req.sql.field('pnad.faixa_etaria_31_03','age_range')
req.sql.where(convert(req.filter.education_level_basic)); req.sql.group('pnad.faixa_etaria_31_03', 'age_range')
} }
} else if ( "education_level_basic" in req.dims ) {
req.sql.field('pnad.faixa_etaria_31_03','age_range')
req.sql.where('pnad.faixa_etaria_31_03 = 1 OR pnad.faixa_etaria_31_03 = 2 OR pnad.faixa_etaria_31_03 = 3 OR pnad.faixa_etaria_31_03 = 4 OR pnad.faixa_etaria_31_03 = 5')
req.sql.group('pnad.faixa_etaria_31_03', 'age_range');
} else { } else {
res.status(400); res.status(400);
next({ next({
...@@ -354,7 +364,16 @@ glossEnrollmentRatioApp.get('/', rqf.parse(),(req, res, next) => { ...@@ -354,7 +364,16 @@ glossEnrollmentRatioApp.get('/', rqf.parse(),(req, res, next) => {
next(); next();
}, rqf.build(), query, id2str.transform(), (req, res, next) => { }, rqf.build(), query, id2str.transform(), (req, res, next) => {
req.denominator = req.result; req.denominator = req.result;
//change age range in denominator to match with numerator result
for(let i = 0; i < req.denominator.length; i++) {
if (req.denominator[i].age_range > 2) {
req.denominator[i].age_range = req.denominator[i].age_range + 1;
}
}
// log.debug("Numerador");
// log.debug(req.numerator);
// log.debug("Denominador");
// log.debug(req.denominator);
req.result = [] req.result = []
let glossEnrollment = matchQueries(req.denominator, req.numerator); let glossEnrollment = matchQueries(req.denominator, req.numerator);
req.result = glossEnrollment; req.result = glossEnrollment;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment