Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
simcaq-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
simcaq
simcaq-node
Commits
8630a114
Commit
8630a114
authored
2 months ago
by
Fernando Gbur dos Santos
Browse files
Options
Downloads
Plain Diff
Merge branch 'development' into 'homologa'
dev -> homologa See merge request
!476
parents
9ece5d11
07d44110
Branches
Branches containing commit
No related tags found
3 merge requests
!501
[hotfix] capital filter working for superior education conclusion tax...
,
!499
[hotfix] capital filter working for superior education conclusion tax...
,
!476
dev -> homologa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libs/convert/ageRangeAll.js
+1
-1
1 addition, 1 deletion
src/libs/convert/ageRangeAll.js
src/libs/routes_v1/superiorEducationConclusionTax.js
+32
-17
32 additions, 17 deletions
src/libs/routes_v1/superiorEducationConclusionTax.js
with
33 additions
and
18 deletions
src/libs/convert/ageRangeAll.js
+
1
−
1
View file @
8630a114
...
...
@@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
*/
module
.
exports
=
function
ageRange
(
id
)
{
module
.
exports
=
function
ageRange
All
(
id
)
{
switch
(
id
)
{
case
1
:
return
'
0 a 3 anos
'
;
...
...
This diff is collapsed.
Click to expand it.
src/libs/routes_v1/superiorEducationConclusionTax.js
+
32
−
17
View file @
8630a114
...
...
@@ -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
'
));
...
...
@@ -160,6 +157,7 @@ superiorEducationConclusionTaxApp.get('/income_range', (req, res, next) => {
});
}
req
.
result
.
push
({
id
:
10
,
name
:
id2str
.
incomeRange
(
10
)});
next
();
},
response
(
'
income_range
'
));
...
...
@@ -242,16 +240,17 @@ superiorEducationConclusionTaxApp.get('/state', (req, res, next) => {
next
();
},
response
(
'
state
'
));
superiorEducationConclusionTaxApp
.
get
(
'
/age_range
'
,
(
req
,
res
,
next
)
=>
{
superiorEducationConclusionTaxApp
.
get
(
'
/age_range
_all
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[]
for
(
let
i
=
1
;
i
<
12
;
i
++
)
{
for
(
let
i
=
7
;
i
<
12
;
i
++
)
{
req
.
result
.
push
({
id
:
i
,
name
:
id2str
.
ageRangeAll
(
i
)
});
}
console
.
log
(
req
.
result
);
next
();
},
response
(
'
age_range
'
));
},
response
(
'
age_range
_all
'
));
superiorEducationConclusionTaxApp
.
get
(
'
/location
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[]
...
...
@@ -444,10 +443,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 +574,27 @@ 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`
;
}
if
(
dims
&&
dims
.
includes
(
"
income_range
"
)){
where
+=
`pnad_novo.faixa_rendimento_aux_tx is not null`
;
}
if
(
dims
&&
dims
.
includes
(
"
age_range_superior
"
)){
where
+=
`pnad_novo.faixa_etaria > 6`
;
}
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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment