Commit 184a8816 authored by Vytor Calixto's avatar Vytor Calixto 👾

Fix bug with duplicate education levels

parent cd30485d
Pipeline #15504 canceled with stage
in 7 seconds
......@@ -447,7 +447,6 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
currentLocation.education_level = [...cityLocation.education_level];
} else {
let l = 0;
// FIXME: erros ao agregar brasil nas regiões 3 e 4
while(l < cityLocation.education_level.length) {
let cityEducation = cityLocation.education_level[l];
let m = 0;
......@@ -467,7 +466,11 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
currentEducation.enrollment.night_classes += cityEducation.enrollment.night_classes;
currentEducation.enrollment.total_classrooms_needed += cityEducation.enrollment.total_classrooms_needed;
} else {
currentLocation.education_level.splice(m, 0, cityEducation);
if(currentEducation.education_level_short_id < cityEducation.education_level_short_id) {
currentLocation.education_level.splice(++m, 0, cityEducation);
} else {
currentLocation.education_level.splice(m, 0, cityEducation);
}
}
++l;
}
......@@ -484,12 +487,6 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
}
}
if(req.dims.state) {
console.log('ESTADO!!!!');
} else if(!req.dims.city) {
console.log('BRASIL!!!');
}
req.result = reduction || result;
next();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment