Skip to content
Snippets Groups Projects
Commit 5d356af1 authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

Fix santa catarina bug

parent 71b78e9f
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -428,6 +428,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => { ...@@ -428,6 +428,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
// Fazer "merge" do array locations da cidade com o da agregação // Fazer "merge" do array locations da cidade com o da agregação
if(currentObj.locations.length == 0) { 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]; currentObj.locations = [...city.locations];
} else { } else {
let j = 0; let j = 0;
...@@ -444,10 +445,16 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => { ...@@ -444,10 +445,16 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
} else if(cityLocation.location_id > currentLocation.location_id) { } else if(cityLocation.location_id > currentLocation.location_id) {
++k; ++k;
currentLocation = currentObj.locations[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; continue;
} }
// Fazer merge do array education_level // Fazer "merge" do array education_level
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 {
...@@ -492,7 +499,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => { ...@@ -492,7 +499,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
} }
} }
req.result = /*{result, enrollments} //*/ reduction || result; req.result = {result: reduction, enrollments} // reduction || result;
next(); next();
}, response('classroom_count')); }, response('classroom_count'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment