Skip to content
Snippets Groups Projects
Commit 1f42013b authored by lgtg20's avatar lgtg20
Browse files

[feature] add region and state filters to adjustedLiquidFrequency query

parent 1798ae1f
Branches
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...,!469Development,!468[feature] add region and state filters to adjustedLiquidFrequency query
...@@ -344,6 +344,9 @@ adjustedLiquidFrequency.get('/', rqf.parse(), (req, res, next) => { ...@@ -344,6 +344,9 @@ adjustedLiquidFrequency.get('/', rqf.parse(), (req, res, next) => {
${dimensions.income_range ? "AND total_pop.income_range_id = pnad_novo.faixa_rendimento_aux" : ""} ${dimensions.income_range ? "AND total_pop.income_range_id = pnad_novo.faixa_rendimento_aux" : ""}
${dimensions.cap_code ? "AND total_pop.cap_code_id = pnad_novo.cod_cap" : ""} ${dimensions.cap_code ? "AND total_pop.cap_code_id = pnad_novo.cod_cap" : ""}
${dimensions.metro_code ? "AND pnad_novo.cod_rm_ride <> 99 AND total_pop.metro_code_id = pnad_novo.cod_rm_ride" : ""} ${dimensions.metro_code ? "AND pnad_novo.cod_rm_ride <> 99 AND total_pop.metro_code_id = pnad_novo.cod_rm_ride" : ""}
${dimensions.region ? "AND total_pop.region_id = pnad_novo.cod_regiao" : ""}
${dimensions.state ? "AND total_pop.state_id = pnad_novo.cod_uf" : ""}
` `
// Subquery: total_apoio_freq // Subquery: total_apoio_freq
...@@ -393,6 +396,12 @@ adjustedLiquidFrequency.get('/', rqf.parse(), (req, res, next) => { ...@@ -393,6 +396,12 @@ adjustedLiquidFrequency.get('/', rqf.parse(), (req, res, next) => {
if (dimensions.metro_code) if (dimensions.metro_code)
mainQuery.field("total_apoio_freq.metro_code_id") mainQuery.field("total_apoio_freq.metro_code_id")
if (dimensions.region)
mainQuery.field("total_apoio_freq.region_id")
if (dimensions.state)
mainQuery.field("total_apoio_freq.state_id")
req.sql = mainQuery; req.sql = mainQuery;
next(); next();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment