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
b300af3e
Commit
b300af3e
authored
6 years ago
by
Vytor Calixto
Browse files
Options
Downloads
Patches
Plain Diff
Add school_years to kindergarden education level
Related: simcaq/SCRUM#408
parent
da2dd6cc
No related branches found
No related tags found
2 merge requests
!162
V1.8.0
,
!160
Issue/423
Pipeline
#17704
canceled
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
+60
-3
60 additions, 3 deletions
src/libs/routes/classroomCount.js
with
60 additions
and
3 deletions
src/libs/routes/classroomCount.js
+
60
−
3
View file @
b300af3e
...
@@ -286,6 +286,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -286,6 +286,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
let
enrollmentMatch
=
true
;
let
enrollmentMatch
=
true
;
j
=
0
;
j
=
0
;
let
educationLevelSet
=
new
Set
();
let
educationLevelSet
=
new
Set
();
let
schoolYearSet
=
new
Set
();
let
enrollment
=
enrollments
[
j
];
let
enrollment
=
enrollments
[
j
];
while
(
enrollmentMatch
&&
j
<
enrollments
.
length
)
{
while
(
enrollmentMatch
&&
j
<
enrollments
.
length
)
{
...
@@ -346,7 +347,11 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -346,7 +347,11 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
total_classrooms_needed
:
0
total_classrooms_needed
:
0
}
}
};
};
if
(
enrollmentEducationLevel
.
id
==
1
)
{
educationLevel
.
classes_school_year
=
[];
}
// Para manter a ordem da etapa de ensino
// Para manter a ordem da etapa de ensino
if
(
location
.
education_level
.
length
==
0
)
{
if
(
location
.
education_level
.
length
==
0
)
{
location
.
education_level
.
push
(
educationLevel
);
location
.
education_level
.
push
(
educationLevel
);
...
@@ -375,6 +380,38 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -375,6 +380,38 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
educationLevel
=
location
.
education_level
[
k
];
educationLevel
=
location
.
education_level
[
k
];
}
}
// Adiciona as séries da creche
let
currentSchoolYear
=
null
;
if
(
enrollmentEducationLevel
.
id
==
1
){
let
schoolYearHash
=
''
+
enrollment
.
year
+
enrollment
.
city_id
+
enrollment
.
location_id
+
enrollment
.
school_year_id
;
if
(
schoolYearSet
.
has
(
schoolYearHash
))
{
// Busca a série escolar
let
k
=
0
;
let
el
=
educationLevel
.
classes_school_year
[
k
];
while
(
k
<
educationLevel
.
classes_school_year
.
length
)
{
if
(
el
.
school_year_id
!=
enrollment
.
school_year_id
)
{
++
k
;
if
(
k
<
educationLevel
.
classes_school_year
.
length
)
el
=
educationLevel
.
classes_school_year
[
k
];
}
else
break
;
}
if
(
k
>=
educationLevel
.
classes_school_year
.
length
)
--
k
;
currentSchoolYear
=
educationLevel
.
classes_school_year
[
k
];
}
else
{
// Adiciona uma nova série escolar
let
school_year
=
{
school_year_id
:
enrollment
.
school_year_id
,
school_year_name
:
enrollment
.
school_year_name
,
total_enrollment_day
:
0
,
total_enrollment_night
:
0
,
full_period_classes
:
0
,
day_classes
:
0
,
night_classes
:
0
,
total_classrooms_needed
:
0
}
schoolYearSet
.
add
(
schoolYearHash
);
educationLevel
.
classes_school_year
.
push
(
school_year
);
currentSchoolYear
=
school_year
;
}
}
// Soma os totais de matrícula da etapa de ensino
// Soma os totais de matrícula da etapa de ensino
educationLevel
.
enrollment
.
total_enrollment_day
+=
(
enrollment
.
period_id
<
3
&&
enrollment
.
period_id
!=
null
)
?
enrollment
.
total
:
0
;
educationLevel
.
enrollment
.
total_enrollment_day
+=
(
enrollment
.
period_id
<
3
&&
enrollment
.
period_id
!=
null
)
?
enrollment
.
total
:
0
;
educationLevel
.
enrollment
.
total_enrollment_night
+=
(
enrollment
.
period_id
==
3
)
?
enrollment
.
total
:
0
;
educationLevel
.
enrollment
.
total_enrollment_night
+=
(
enrollment
.
period_id
==
3
)
?
enrollment
.
total
:
0
;
...
@@ -383,8 +420,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -383,8 +420,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
// Turmas de período integral
// Turmas de período integral
educationLevel
.
enrollment
.
full_period_classes
=
Math
.
ceil
((
educationLevel
.
enrollment
.
total_enrollment_day
*
(
enrollmentEducationLevel
.
offerGoal
/
100
))
/
enrollmentEducationLevel
.
numberStudentClass
);
educationLevel
.
enrollment
.
full_period_classes
=
Math
.
ceil
((
educationLevel
.
enrollment
.
total_enrollment_day
*
(
enrollmentEducationLevel
.
offerGoal
/
100
))
/
enrollmentEducationLevel
.
numberStudentClass
);
// Turmas diurnas
// Turmas diurnas (matrículas diurnas - matrículas integrais)
// Matrículas diurnas - matrículas integrais
educationLevel
.
enrollment
.
day_classes
=
Math
.
ceil
((
educationLevel
.
enrollment
.
total_enrollment_day
*
(
1
-
enrollmentEducationLevel
.
offerGoal
/
100
))
/
enrollmentEducationLevel
.
numberStudentClass
);
educationLevel
.
enrollment
.
day_classes
=
Math
.
ceil
((
educationLevel
.
enrollment
.
total_enrollment_day
*
(
1
-
enrollmentEducationLevel
.
offerGoal
/
100
))
/
enrollmentEducationLevel
.
numberStudentClass
);
// Turmas noturnas
// Turmas noturnas
...
@@ -397,6 +433,27 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -397,6 +433,27 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
educationLevel
.
enrollment
.
total_classrooms_needed
=
Math
.
ceil
(
educationLevel
.
enrollment
.
total_classrooms_needed
);
educationLevel
.
enrollment
.
total_classrooms_needed
=
Math
.
ceil
(
educationLevel
.
enrollment
.
total_classrooms_needed
);
// Faz os mesmos cálculos para a série escolar
if
(
currentSchoolYear
)
{
// Totais de matrícula
currentSchoolYear
.
total_enrollment_day
+=
(
enrollment
.
period_id
<
3
&&
enrollment
.
period_id
!=
null
)
?
enrollment
.
total
:
0
;
currentSchoolYear
.
total_enrollment_night
+=
(
enrollment
.
period_id
==
3
)
?
enrollment
.
total
:
0
;
// Número de turmas parcial
currentSchoolYear
.
full_period_classes
=
Math
.
ceil
((
currentSchoolYear
.
total_enrollment_day
*
(
enrollmentEducationLevel
.
offerGoal
/
100
))
/
enrollmentEducationLevel
.
numberStudentClass
);
currentSchoolYear
.
day_classes
=
Math
.
ceil
((
currentSchoolYear
.
total_enrollment_day
*
(
1
-
enrollmentEducationLevel
.
offerGoal
/
100
))
/
enrollmentEducationLevel
.
numberStudentClass
);
currentSchoolYear
.
night_classes
=
Math
.
ceil
((
currentSchoolYear
.
total_enrollment_night
/
enrollmentEducationLevel
.
numberStudentClass
));
// Total de salas
currentSchoolYear
.
total_classrooms_needed
=
(
currentSchoolYear
.
full_period_classes
+
currentSchoolYear
.
day_classes
/
2
);
if
(
currentSchoolYear
.
night_classes
>
(
currentSchoolYear
.
day_classes
/
2
))
currentSchoolYear
.
total_classrooms_needed
+=
(
currentSchoolYear
.
night_classes
-
(
currentSchoolYear
.
day_classes
/
2
));
currentSchoolYear
.
total_classrooms_needed
=
Math
.
ceil
(
currentSchoolYear
.
total_classrooms_needed
);
}
enrollment
=
enrollments
[
j
];
enrollment
=
enrollments
[
j
];
}
}
...
...
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