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
9bbc0b82
There was a problem fetching the pipeline summary.
Commit
9bbc0b82
authored
6 years ago
by
Vytor Calixto
Browse files
Options
Downloads
Plain Diff
Merge branch 'hotfix_1.2.2' into development
parents
f70a7374
789d62cf
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+4
-0
4 additions, 0 deletions
CHANGELOG.md
src/libs/routes/classroomCount.js
+14
-9
14 additions, 9 deletions
src/libs/routes/classroomCount.js
with
18 additions
and
9 deletions
CHANGELOG.md
+
4
−
0
View file @
9bbc0b82
...
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
...
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on
[
Keep a Changelog
](
http://keepachangelog.com/
)
The format is based on
[
Keep a Changelog
](
http://keepachangelog.com/
)
and this project adheres to
[
Semantic Versioning
](
http://semver.org/
)
.
and this project adheres to
[
Semantic Versioning
](
http://semver.org/
)
.
## 1.2.2 - 2018-05-22
### Changed
-
Fixed bug with missing education levels in classroom count
## 1.2.1 - 2018-05-22
## 1.2.1 - 2018-05-22
### Changed
### Changed
-
Add state id in infrastructure
-
Add state id in infrastructure
...
...
This diff is collapsed.
Click to expand it.
src/libs/routes/classroomCount.js
+
14
−
9
View file @
9bbc0b82
...
@@ -184,7 +184,8 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -184,7 +184,8 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
.
from
(
'
matricula
'
)
.
from
(
'
matricula
'
)
.
group
(
'
matricula.ano_censo
'
)
.
group
(
'
matricula.ano_censo
'
)
.
order
(
'
matricula.ano_censo
'
)
.
order
(
'
matricula.ano_censo
'
)
.
where
(
'
matricula.tipo<=3
'
);
.
where
(
'
matricula.tipo<=3
'
)
.
where
(
'
matricula.dependencia_adm_id < 4
'
);
next
();
next
();
},
rqf
.
build
(),
query
,
id2str
.
transform
(),
(
req
,
res
,
next
)
=>
{
},
rqf
.
build
(),
query
,
id2str
.
transform
(),
(
req
,
res
,
next
)
=>
{
...
@@ -225,7 +226,8 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -225,7 +226,8 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
.
from
(
'
escola
'
)
.
from
(
'
escola
'
)
.
group
(
'
escola.ano_censo
'
)
.
group
(
'
escola.ano_censo
'
)
.
order
(
'
escola.ano_censo
'
)
.
order
(
'
escola.ano_censo
'
)
.
where
(
'
escola.situacao_de_funcionamento = 1 AND escola.local_func_predio_escolar = 1
'
);
.
where
(
'
escola.situacao_de_funcionamento = 1 AND escola.local_func_predio_escolar = 1
'
)
.
where
(
'
escola.dependencia_adm_id < 4
'
);
next
();
next
();
},
rqf
.
build
(),
query
,
id2str
.
transform
(),
(
req
,
res
,
next
)
=>
{
},
rqf
.
build
(),
query
,
id2str
.
transform
(),
(
req
,
res
,
next
)
=>
{
...
@@ -243,6 +245,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -243,6 +245,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
let
j
=
0
;
let
j
=
0
;
let
result
=
[];
let
result
=
[];
let
hashSet
=
new
Set
();
let
hashSet
=
new
Set
();
let
enrollments
=
[...
req
.
enrollment
];
while
(
i
<
req
.
classroom
.
length
)
{
while
(
i
<
req
.
classroom
.
length
)
{
let
classroom
=
req
.
classroom
[
i
];
let
classroom
=
req
.
classroom
[
i
];
// Cria hash única para cada espacialidade, dado um ano
// Cria hash única para cada espacialidade, dado um ano
...
@@ -282,14 +285,15 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -282,14 +285,15 @@ 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
();
while
(
enrollmentMatch
&&
j
<
req
.
enrollment
.
length
)
{
let
enrollment
=
enrollments
[
j
];
let
enrollment
=
req
.
enrollment
[
j
];
while
(
enrollmentMatch
&&
j
<
enrollments
.
length
)
{
enrollment
=
enrollments
[
j
];
if
(
typeof
enrollment
===
'
undefined
'
)
{
if
(
typeof
enrollment
===
'
undefined
'
)
{
enrollmentMatch
=
false
;
++
j
;
continue
;
continue
;
}
}
if
(
enrollment
.
city_id
!=
classroom
.
city_id
)
{
// Se as cidades não são iguais, já passamos do range
if
(
enrollment
.
city_id
!=
classroom
.
city_id
)
{
// Se as cidades não são iguais, já passamos do range
enrollmentMatch
=
false
;
++
j
;
continue
;
continue
;
}
}
...
@@ -300,13 +304,13 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -300,13 +304,13 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
// Remove se o período é nulo (não dá pra usar no cálculo)
// Remove se o período é nulo (não dá pra usar no cálculo)
if
(
enrollment
.
period_id
==
null
)
{
if
(
enrollment
.
period_id
==
null
)
{
req
.
enrollment
.
splice
(
j
,
1
);
enrollment
s
.
splice
(
j
,
1
);
continue
;
continue
;
}
}
// Temos uma matrícula com cidade, ano e localidades certos
// Temos uma matrícula com cidade, ano e localidades certos
// "Consome" a matrícula (remove do vetor de matrículas)
// "Consome" a matrícula (remove do vetor de matrículas)
req
.
enrollment
.
splice
(
j
,
1
);
enrollment
s
.
splice
(
j
,
1
);
// Cria a etapa de ensino adequada
// Cria a etapa de ensino adequada
let
enrollmentEducationLevel
=
req
.
educationSchoolYear
[
enrollment
.
school_year_id
];
let
enrollmentEducationLevel
=
req
.
educationSchoolYear
[
enrollment
.
school_year_id
];
...
@@ -377,6 +381,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -377,6 +381,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
if
(
educationLevel
.
enrollment
.
night_classes
>
educationLevel
.
enrollment
.
day_classes
)
educationLevel
.
enrollment
.
total_classrooms_needed
+=
(
educationLevel
.
enrollment
.
night_classes
-
educationLevel
.
enrollment
.
day_classes
);
if
(
educationLevel
.
enrollment
.
night_classes
>
educationLevel
.
enrollment
.
day_classes
)
educationLevel
.
enrollment
.
total_classrooms_needed
+=
(
educationLevel
.
enrollment
.
night_classes
-
educationLevel
.
enrollment
.
day_classes
);
enrollment
=
enrollments
[
j
];
}
}
// Calculamos o total classroom be built para o município usando reduce
// Calculamos o total classroom be built para o município usando reduce
...
@@ -487,7 +492,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
...
@@ -487,7 +492,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
}
}
}
}
req
.
result
=
reduction
||
result
;
req
.
result
=
/*{result, enrollments} //*/
reduction
||
result
;
next
();
next
();
},
response
(
'
classroom_count
'
));
},
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