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
ad10291f
There was a problem fetching the pipeline summary.
Commit
ad10291f
authored
8 years ago
by
Vytor Calixto
Browse files
Options
Downloads
Patches
Plain Diff
Add id2str in enrollment
parent
dc4b39b4
No related branches found
No related tags found
3 merge requests
!116
Release v1.0.0
,
!44
Feature multiple where
,
!35
Feature id2str
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libs/routes/enrollment.js
+7
-119
7 additions, 119 deletions
src/libs/routes/enrollment.js
with
7 additions
and
119 deletions
src/libs/routes/enrollment.js
+
7
−
119
View file @
ad10291f
...
...
@@ -14,6 +14,8 @@ const response = require(`${libs}/middlewares/response`);
const
ReqQueryFields
=
require
(
`
${
libs
}
/middlewares/reqQueryFields`
);
const
id2str
=
require
(
`
${
libs
}
/middlewares/id2str`
);
let
rqf
=
new
ReqQueryFields
();
// Complete range of the enrollments dataset.
...
...
@@ -281,121 +283,7 @@ enrollmentApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
.
order
(
'
matricula.ano_censo
'
)
.
where
(
'
matricula.tipo=0 OR matricula.tipo=1 OR matricula.tipo=2 OR matricula.tipo=3
'
);
next
();
},
query
,
(
req
,
res
,
next
)
=>
{
// ids to strings
req
.
result
.
forEach
((
result
)
=>
{
if
(
typeof
result
.
gender_id
!==
'
undefined
'
)
{
switch
(
result
.
gender_id
)
{
case
1
:
result
.
gender_name
=
'
Masculino
'
;
break
;
case
2
:
result
.
gender_name
=
'
Feminino
'
;
break
;
}
delete
result
.
gender_id
;
}
if
(
typeof
result
.
period_id
!==
'
undefined
'
)
{
switch
(
result
.
period_id
)
{
case
1
:
result
.
period_name
=
'
Diurno
'
;
break
;
case
2
:
result
.
period_name
=
'
Noturno
'
;
break
;
case
3
:
result
.
period_name
=
'
Integral
'
;
break
;
default
:
result
.
period_name
=
'
Indefinido
'
;
break
;
}
delete
result
.
period_id
;
}
});
next
();
},
response
(
'
enrollment
'
));
function
schoolYearIdToStr
(
schoolYearId
)
{
let
schoolYearStr
;
switch
(
schoolYearId
)
{
case
11
:
schoolYearStr
=
'
Creche - Menor de 1 ano
'
;
break
;
case
12
:
schoolYearStr
=
'
Creche - 1 ano
'
;
break
;
case
13
:
schoolYearStr
=
'
Creche - 2 anos
'
;
break
;
case
14
:
schoolYearStr
=
'
Creche - 3 anos
'
;
break
;
case
21
:
schoolYearStr
=
'
Pré-escola - 4 anos
'
;
break
;
case
22
:
schoolYearStr
=
'
Pré-escola - 5 anos
'
;
break
;
case
31
:
schoolYearStr
=
'
Ens. Fundamental - 1º Ano
'
;
break
;
case
32
:
schoolYearStr
=
'
Ens. Fundamental - 1ª série/2º ano
'
;
break
;
case
33
:
schoolYearStr
=
'
Ens. Fundamental - 2ª série/3º ano
'
;
break
;
case
34
:
schoolYearStr
=
'
Ens. Fundamental - 3ª série/4º ano
'
;
break
;
case
35
:
schoolYearStr
=
'
Ens. Fundamental - 4ª série/5º Ano
'
;
break
;
case
41
:
schoolYearStr
=
'
Ens. Fundamental - 5ª série/6º ano
'
;
break
;
case
42
:
schoolYearStr
=
'
Ens. Fundamental - 6ª série/7º ano
'
;
break
;
case
43
:
schoolYearStr
=
'
Ens. Fundamental - 7ª série/8º ano
'
;
break
;
case
44
:
schoolYearStr
=
'
Ens. Fundamental - 8ª serie/9º ano
'
;
break
;
case
51
:
schoolYearStr
=
'
Ens. Médio - 1ª série
'
;
// equivalent to 'EM 1 Série'
break
;
case
52
:
schoolYearStr
=
'
Ens. Médio - 2ª série
'
;
// equivalent to 'EM 2 Série'
break
;
case
53
:
schoolYearStr
=
'
Ens. Médio - 3ª série
'
;
// equivalent to 'EM 3 Série'
break
;
case
54
:
schoolYearStr
=
'
Ens. Médio - 4ª série
'
;
// equivalent to 'EM 4 Série'
break
;
case
61
:
schoolYearStr
=
'
EJA - anos iniciais do Ens. Fundamental
'
;
break
;
case
62
:
schoolYearStr
=
'
EJA - anos finais do Ens. Fundamental
'
;
break
;
case
63
:
schoolYearStr
=
'
EJA - Ensino Médio
'
;
break
;
case
64
:
schoolYearStr
=
'
EJA semi-presencial
'
;
break
;
case
71
:
schoolYearStr
=
'
Educação Profissional
'
;
break
;
default
:
schoolYearStr
=
'
Não classificado
'
;
}
return
schoolYearStr
;
}
},
query
,
id2str
(
true
),
response
(
'
enrollment
'
));
let
simRqf
=
new
ReqQueryFields
();
...
...
@@ -433,7 +321,7 @@ enrollmentApp.get('/offer_projection', simRqf.parse(), simRqf.build(), (req, res
.
field
(
'
turma.turno
'
,
'
period_id
'
)
.
field
(
'
etapa_ensino.desc_etapa
'
,
'
education_level_name
'
)
.
field
(
'
etapa_ensino.id
'
,
'
education_level_id
'
)
.
field
(
'
matricula.serie_ano_id
'
)
.
field
(
'
matricula.serie_ano_id
'
,
'
school_year_id
'
)
.
field
(
'
COUNT(matricula.id)
'
,
'
currentOffer
'
)
.
from
(
'
matricula
'
)
.
join
(
'
etapa_ensino
'
,
null
,
'
matricula.etapa_ensino_id=etapa_ensino.id
'
)
...
...
@@ -448,7 +336,7 @@ enrollmentApp.get('/offer_projection', simRqf.parse(), simRqf.build(), (req, res
.
group
(
'
matricula.serie_ano_id
'
);
next
();
},
query
,
(
req
,
res
,
next
)
=>
{
},
query
,
id2str
(
false
),
(
req
,
res
,
next
)
=>
{
let
years
=
parseInt
(
req
.
filter
.
simulation_time
,
10
);
if
(
isNaN
(
years
))
years
=
0
;
let
offerYear
=
req
.
result
[
0
].
offerYear
;
...
...
@@ -471,8 +359,8 @@ enrollmentApp.get('/offer_projection', simRqf.parse(), simRqf.build(), (req, res
}
temp
[
period
][
i
.
education_level_name
].
currentOffer
+=
i
.
currentOffer
;
temp
[
period
][
i
.
education_level_name
].
grades
.
push
({
id
:
i
.
s
erie_ano
_id
,
name
:
school
Y
ear
IdToStr
(
i
.
serie_ano_id
)
,
id
:
i
.
s
chool_year
_id
,
name
:
i
.
school
_y
ear
_name
,
currentOffer
:
i
.
currentOffer
});
});
...
...
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