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
35207a97
Commit
35207a97
authored
6 years ago
by
Vytor Calixto
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug with state and country aggregation in classroom_count
Related: simcaq/SCRUM#408
parent
3a3bf614
No related branches found
No related tags found
2 merge requests
!162
V1.8.0
,
!159
Issue/408
Pipeline
#17943
failed
6 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libs/routes/classroomCount.js
+39
-2
39 additions, 2 deletions
src/libs/routes/classroomCount.js
with
39 additions
and
2 deletions
src/libs/routes/classroomCount.js
+
39
−
2
View file @
35207a97
...
@@ -534,10 +534,11 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -534,10 +534,11 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
continue
;
continue
;
}
}
// Fazer "merge" do array education_level
// Faz "merge" do array education_level
// Se a localidade atual não tem o vetor
if
(
currentLocation
.
education_level
.
length
==
0
)
{
if
(
currentLocation
.
education_level
.
length
==
0
)
{
currentLocation
.
education_level
=
[...
cityLocation
.
education_level
];
currentLocation
.
education_level
=
[...
cityLocation
.
education_level
];
}
else
{
}
else
{
// Caso já tenha, atualiza os valores
let
l
=
0
;
let
l
=
0
;
while
(
l
<
cityLocation
.
education_level
.
length
)
{
while
(
l
<
cityLocation
.
education_level
.
length
)
{
let
cityEducation
=
cityLocation
.
education_level
[
l
];
let
cityEducation
=
cityLocation
.
education_level
[
l
];
...
@@ -557,6 +558,42 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -557,6 +558,42 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
currentEducation
.
enrollment
.
day_classes
+=
cityEducation
.
enrollment
.
day_classes
;
currentEducation
.
enrollment
.
day_classes
+=
cityEducation
.
enrollment
.
day_classes
;
currentEducation
.
enrollment
.
night_classes
+=
cityEducation
.
enrollment
.
night_classes
;
currentEducation
.
enrollment
.
night_classes
+=
cityEducation
.
enrollment
.
night_classes
;
currentEducation
.
enrollment
.
total_classrooms_needed
+=
cityEducation
.
enrollment
.
total_classrooms_needed
;
currentEducation
.
enrollment
.
total_classrooms_needed
+=
cityEducation
.
enrollment
.
total_classrooms_needed
;
if
((
typeof
cityEducation
.
classes_school_year
!==
'
undefined
'
)
&&
(
typeof
currentEducation
.
classes_school_year
!==
'
undefined
'
))
{
let
n
=
0
;
let
o
=
0
;
let
cityClass
=
null
;
let
currentClass
=
null
;
while
((
typeof
cityClass
!==
'
undefined
'
)
&&
(
typeof
currentClass
!==
'
undefined
'
))
{
cityClass
=
cityEducation
.
classes_school_year
[
o
];
currentClass
=
currentEducation
.
classes_school_year
[
n
];
// Se a série escolar é menor que a atual, ela não está no vetor, pois o vetor está ordenado e tem range limitado
if
(
cityClass
.
school_year_id
<
currentClass
.
school_year_id
)
{
currentEducation
.
classes_school_year
.
splice
(
n
,
0
,
cityClass
);
++
o
;
continue
;
}
else
if
(
cityClass
.
school_year_id
>
currentClass
.
school_year_id
)
{
currentClass
=
currentEducation
.
classes_school_year
[
++
n
];
// Se o ano escolar da cidade é maior que a localidade do objeto atual E o vetor de ano escolar do objeto atual
// acaba, então este ano escolar falta no objeto atual, pois os anos escolares estão ordenados
if
(
typeof
currentClass
==
'
undefined
'
&&
typeof
cityClass
!==
'
undefined
'
)
{
currentEducation
.
classes_school_year
[
n
]
=
cityClass
;
currentClass
=
currentEducation
.
classes_school_year
[
n
];
}
continue
;
}
currentClass
.
total_enrollment_day
+=
cityClass
.
total_enrollment_day
;
currentClass
.
total_enrollment_night
+=
cityClass
.
total_enrollment_night
;
currentClass
.
full_period_classes
+=
cityClass
.
full_period_classes
;
currentClass
.
day_classes
+=
cityClass
.
day_classes
;
currentClass
.
night_classes
+=
cityClass
.
night_classes
;
currentClass
.
total_classrooms_needed
+=
cityClass
.
total_classrooms_needed
;
cityClass
=
cityEducation
.
classes_school_year
[
++
o
];
}
}
}
else
{
}
else
{
if
(
currentEducation
.
education_level_short_id
<
cityEducation
.
education_level_short_id
)
{
if
(
currentEducation
.
education_level_short_id
<
cityEducation
.
education_level_short_id
)
{
currentLocation
.
education_level
.
splice
(
++
m
,
0
,
cityEducation
);
currentLocation
.
education_level
.
splice
(
++
m
,
0
,
cityEducation
);
...
...
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