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
b965d473
Commit
b965d473
authored
6 years ago
by
Vytor Calixto
Browse files
Options
Downloads
Plain Diff
Merge branch 'classroom_count' into hotfix_v1.2.3
parents
cdf491ef
9587fed3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libs/routes/classroomCount.js
+24
-9
24 additions, 9 deletions
src/libs/routes/classroomCount.js
with
24 additions
and
9 deletions
src/libs/routes/classroomCount.js
+
24
−
9
View file @
b965d473
...
...
@@ -286,13 +286,25 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
j
=
0
;
let
educationLevelSet
=
new
Set
();
let
enrollment
=
enrollments
[
j
];
while
(
enrollmentMatch
&&
j
<
enrollments
.
length
)
{
enrollment
=
enrollments
[
j
];
// Remove se o período é nulo (não dá pra usar no cálculo)
if
(
enrollment
.
period_id
==
null
)
{
enrollments
.
splice
(
j
,
1
);
continue
;
}
if
(
typeof
enrollment
===
'
undefined
'
)
{
++
j
;
continue
;
}
if
(
enrollment
.
city_id
!=
classroom
.
city_id
)
{
// Se as cidades não são iguais, já passamos do range
if
(
classroom
.
city_name
<
enrollment
.
city_name
)
{
// Se as cidades não são iguais, já passamos do range
enrollmentMatch
=
false
;
continue
;
}
else
if
(
classroom
.
city_name
>
enrollment
.
city_name
)
{
++
j
;
continue
;
}
...
...
@@ -302,11 +314,6 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
continue
;
}
// Remove se o período é nulo (não dá pra usar no cálculo)
if
(
enrollment
.
period_id
==
null
)
{
enrollments
.
splice
(
j
,
1
);
continue
;
}
// Temos uma matrícula com cidade, ano e localidades certos
// "Consome" a matrícula (remove do vetor de matrículas)
...
...
@@ -371,7 +378,8 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
educationLevel
.
enrollment
.
full_period_classes
=
Math
.
ceil
((
educationLevel
.
enrollment
.
total_enrollment_day
*
(
enrollmentEducationLevel
.
offerGoal
/
100
))
/
enrollmentEducationLevel
.
numberStudentClass
);
// Turmas diurnas
educationLevel
.
enrollment
.
day_classes
=
Math
.
ceil
((
educationLevel
.
enrollment
.
total_enrollment_day
/
enrollmentEducationLevel
.
numberStudentClass
)
-
educationLevel
.
enrollment
.
full_period_classes
);
// Matrículas diurnas - matrículas integrais
educationLevel
.
enrollment
.
day_classes
=
Math
.
ceil
((
educationLevel
.
enrollment
.
total_enrollment_day
*
(
1
-
enrollmentEducationLevel
.
offerGoal
/
100
))
/
enrollmentEducationLevel
.
numberStudentClass
);
// Turmas noturnas
educationLevel
.
enrollment
.
night_classes
=
Math
.
ceil
((
educationLevel
.
enrollment
.
total_enrollment_night
/
enrollmentEducationLevel
.
numberStudentClass
));
...
...
@@ -428,6 +436,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
// Fazer "merge" do array locations da cidade com o da agregação
if
(
currentObj
.
locations
.
length
==
0
)
{
// Pode ser que a cidade atual tenha menos localidades que o total (só urbana ou só rural)
currentObj
.
locations
=
[...
city
.
locations
];
}
else
{
let
j
=
0
;
...
...
@@ -444,10 +453,16 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
}
else
if
(
cityLocation
.
location_id
>
currentLocation
.
location_id
)
{
++
k
;
currentLocation
=
currentObj
.
locations
[
k
];
// Se a localidade da cidade é maior que a localidade do objeto atual E o vetor de localidades do objeto atual
// acaba, então esta localidade falta no objeto atual, pois as localidades estão ordenadas
if
(
typeof
currentLocation
==
'
undefined
'
&&
typeof
cityLocation
!==
'
undefined
'
)
{
currentObj
.
locations
[
k
]
=
cityLocation
;
currentLocation
=
currentObj
.
locations
[
k
];
}
continue
;
}
// Fazer merge do array education_level
// Fazer
"
merge
"
do array education_level
if
(
currentLocation
.
education_level
.
length
==
0
)
{
currentLocation
.
education_level
=
[...
cityLocation
.
education_level
];
}
else
{
...
...
@@ -492,7 +507,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
}
}
req
.
result
=
/*{result, enrollments} //*/
reduction
||
result
;
req
.
result
=
reduction
||
result
;
next
();
},
response
(
'
classroom_count
'
));
...
...
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