From d96901756d585f4c7107150e53585280b014060a Mon Sep 17 00:00:00 2001 From: Lewis <lgtg20@inf.ufpr.br> Date: Fri, 8 Nov 2024 11:54:37 -0300 Subject: [PATCH] feat: fix year range problem, add location options get --- src/libs/routes_v1/basicEducationConclusion.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/libs/routes_v1/basicEducationConclusion.js b/src/libs/routes_v1/basicEducationConclusion.js index d9ca2b3a..44436759 100644 --- a/src/libs/routes_v1/basicEducationConclusion.js +++ b/src/libs/routes_v1/basicEducationConclusion.js @@ -47,6 +47,7 @@ basicEducationConclusion.use(cache('15 day')); basicEducationConclusion.get('/years', (req, res, next) => { req.sql.from('pnad_novo') .field('DISTINCT pnad_novo.ano_ref', 'year') + .where('pnad_novo.ano_ref >= 2019') next(); }, query, response('years')); @@ -252,6 +253,17 @@ basicEducationConclusion.get('/age_range_all', (req, res, next) => { next(); }, response('age_range_all')); +basicEducationConclusion.get('/location', (req, res, next) => { + req.result = [] + for (let i = 1; i <= 2; i++) { + req.result.push({ + id: i, name: id2str.location(i) + }); + } + + next(); +}, response('location')); + rqf.addField({ name: 'filter', @@ -569,7 +581,7 @@ basicEducationConclusion.get('/', rqf.parse(), rqf.build(), (req, res, next) => // Subquery para total_pop_maior_19 com filtros dinâmicos let totalPopMaior19 = req.sql.clone(); totalPopMaior19.from("pnad_novo") - .field("ano_ref") + .field("ano_ref", "year") .field("SUM(peso_domicilio_pessoas_com_cal)", "total") .where("idade_morador_31_03 >= 19") .where("ano_ref >= 2019") @@ -578,7 +590,7 @@ basicEducationConclusion.get('/', rqf.parse(), rqf.build(), (req, res, next) => // Subquery para total_pop_ed_bas_maior_19 com filtros dinâmicos let totalPopEdBasMaior19 = req.sql.clone(); totalPopEdBasMaior19.from("pnad_novo") - .field("ano_ref") + .field("ano_ref", "year") .field("SUM(peso_domicilio_pessoas_com_cal)", "total") .where("idade_morador_31_03 >= 19") .where("nivel_de_instruc_mais_elevad_para_o_fundam_com_duracao_9_anos IN (5, 6, 7)") -- GitLab