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
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
4039497c
Commit
4039497c
authored
5 years ago
by
Fernando Erd
Browse files
Options
Downloads
Patches
Plain Diff
Add null case in employees
parent
0f038a6b
No related branches found
No related tags found
1 merge request
!257
V1.14.0
Pipeline
#23208
failed
5 years ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libs/routes/employees.js
+21
-10
21 additions, 10 deletions
src/libs/routes/employees.js
with
21 additions
and
10 deletions
src/libs/routes/employees.js
+
21
−
10
View file @
4039497c
...
...
@@ -447,6 +447,7 @@ rqfTeacher.addField({
}
});
function
formatFunction
(
queryOriginal
,
reqDims
)
{
delete
reqDims
.
size
;
delete
reqDims
.
function
;
...
...
@@ -465,7 +466,8 @@ function formatFunction(queryOriginal,reqDims) {
qtde_pedagogia
:
"
Pedagogia
"
,
qtde_secretario
:
"
Secretário
"
,
qtde_seguranca
:
"
Segurança
"
,
qtde_monitores
:
"
Monitores
"
qtde_monitores
:
"
Monitores
"
,
qtde_null
:
"
Não Classificada
"
}
let
resultObj
=
[]
//Nesse caso apenas precisamos acertar as dimensoes que o banco retorna, ou seja, criando um objeto para cada funcao de funcionario
...
...
@@ -551,14 +553,22 @@ function matchQueries(queryTotal, queryPartial) {
employeesApp
.
get
(
'
/
'
,
rqfSchool
.
parse
(),
(
req
,
res
,
next
)
=>
{
req
.
allTeacher
=
{}
req
.
schoolTable
=
{}
delete
req
.
dims
.
function
;
if
(
"
function
"
in
req
.
dims
)
{
delete
req
.
dims
.
function
;
req
.
sql
.
field
(
'
SUM(funcionarios_por_escola.total)
'
,
'
qtde_null
'
)
.
field
(
'
funcionarios_por_escola.ano_censo
'
,
'
year
'
)
.
from
(
'
funcionarios_por_escola
'
)
.
group
(
'
funcionarios_por_escola.ano_censo
'
)
.
order
(
'
funcionarios_por_escola.ano_censo
'
)
}
else
{
delete
req
.
dims
.
function
;
req
.
sql
.
field
(
'
SUM(funcionarios_por_escola.total)
'
,
'
total
'
)
.
field
(
'
funcionarios_por_escola.ano_censo
'
,
'
year
'
)
.
from
(
'
funcionarios_por_escola
'
)
.
group
(
'
funcionarios_por_escola.ano_censo
'
)
.
order
(
'
funcionarios_por_escola.ano_censo
'
)
.
where
(
'
(funcionarios_por_escola.ano_censo <> 2009 or funcionarios_por_escola.estado_id <> 42)
'
)
}
next
();
},
rqfSchool
.
build
(),
query
,
rqfSchool
.
parse
(),
id2str
.
transform
(),
(
req
,
res
,
next
)
=>
{
...
...
@@ -601,6 +611,7 @@ employeesApp.get('/', rqfSchool.parse(), (req, res, next) => {
if
(
"
function
"
in
req
.
dims
)
{
let
aux_employes
=
formatFunction
(
req
.
result
,
req
.
dims
);
req
.
allTeacher
=
formatFunction
(
req
.
allTeacher
,
req
.
dims
);
req
.
schoolTable
=
aux_employes
;
}
else
{
req
.
schoolTable
=
req
.
result
...
...
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