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
2a51e27e
Commit
2a51e27e
authored
2 years ago
by
Leon A. Okida Gonçalves
Browse files
Options
Downloads
Patches
Plain Diff
Add shift converter
parent
94f3e0e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!377
prd_version of simcaq
,
!373
merge dev -> homologa
,
!367
Add functional version of middleware, add flag to check whether it runs...
,
!366
Add functional version of middleware, add flag to check whether it runs...
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/libs/convert/shift.js
+30
-0
30 additions, 0 deletions
src/libs/convert/shift.js
src/libs/middlewares/id2str.js
+5
-2
5 additions, 2 deletions
src/libs/middlewares/id2str.js
src/libs/routes_v2/simcaqFirstReport.js
+10
-3
10 additions, 3 deletions
src/libs/routes_v2/simcaqFirstReport.js
with
45 additions
and
5 deletions
src/libs/convert/shift.js
0 → 100644
+
30
−
0
View file @
2a51e27e
/*
Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
This file is part of simcaq-node.
simcaq-node is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
simcaq-node is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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
shift
(
id
)
{
switch
(
id
)
{
case
1
:
return
'
Parcial
'
;
case
2
:
return
'
Integral
'
;
default
:
return
'
Não especificado
'
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/libs/middlewares/id2str.js
+
5
−
2
View file @
2a51e27e
...
...
@@ -95,6 +95,7 @@ const enrollmentSituation = require(`${libs}/convert/enrollmentSituation`);
const
diffLocation
=
require
(
`
${
libs
}
/convert/diffLocation`
);
const
peePorCategoria
=
require
(
`
${
libs
}
/convert/peePorCategoria`
);
const
pee
=
require
(
`
${
libs
}
/convert/booleanVariable`
);
const
shift
=
require
(
`
${
libs
}
/convert/shift`
);
const
ids
=
{
gender_id
:
gender
,
...
...
@@ -181,7 +182,8 @@ const ids = {
enrollment_situation
:
enrollmentSituation
,
diff_location_id
:
diffLocation
,
pee_por_categoria
:
peePorCategoria
,
pee_id
:
pee
pee_id
:
pee
,
shift_id
:
shift
};
function
transform
(
removeId
=
false
)
{
...
...
@@ -295,5 +297,6 @@ module.exports = {
enrollmentSituation
,
diffLocation
,
peePorCategoria
,
pee
pee
,
shift
};
This diff is collapsed.
Click to expand it.
src/libs/routes_v2/simcaqFirstReport.js
+
10
−
3
View file @
2a51e27e
...
...
@@ -40,6 +40,8 @@ const cache = require('apicache').options({ debug: config.debug, statusCodes: {i
let
rqf
=
new
ReqQueryFields
();
const
id2str
=
require
(
`
${
libs
}
/middlewares/id2str`
);
simcaqFirstReportApp
.
use
(
cache
(
'
15 day
'
));
rqf
.
addField
({
...
...
@@ -110,7 +112,7 @@ rqf.addField({
field
:
'
etapa
'
}
}).
addValue
({
name
:
'
shift
'
,
name
:
'
shift
_id
'
,
table
:
'
simcaq_relatorio_1
'
,
tableField
:
'
turno
'
,
where
:
{
...
...
@@ -123,7 +125,7 @@ rqf.addField({
simcaqFirstReportApp
.
get
(
'
/
'
,
rqf
.
parse
(),
rqf
.
build
(),
(
req
,
res
,
next
)
=>
{
req
.
sql
.
from
(
'
simcaq_relatorio_1
'
)
.
field
(
'
simcaq_relatorio_1.etapa
'
,
'
education_level_short_id
'
)
.
field
(
'
simcaq_relatorio_1.turno
'
,
'
shift
'
)
.
field
(
'
simcaq_relatorio_1.turno
'
,
'
shift
_id
'
)
.
field
(
'
simcaq_relatorio_1.localizacao_id
'
,
'
location
'
)
.
field
(
'
SUM(simcaq_relatorio_1.num_matriculas)
'
,
'
num_enrollments
'
)
.
field
(
'
SUM(simcaq_relatorio_1.num_escolas)
'
,
'
num_schools
'
)
...
...
@@ -133,6 +135,11 @@ simcaqFirstReportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
.
group
(
'
simcaq_relatorio_1.turno
'
)
.
group
(
'
simcaq_relatorio_1.localizacao_id
'
);
next
();
},
query
,
response
(
'
simcaqFirstReport
'
));
},
query
,
(
req
,
res
,
next
)
=>
{
req
.
result
.
forEach
((
result
)
=>
{
result
.
shift
=
id2str
.
shift
(
result
.
shift_id
);
});
next
();
},
response
(
'
simcaqFirstReport
'
));
module
.
exports
=
simcaqFirstReportApp
;
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