diff --git a/src/libs/routes_v2/classroomCount.js b/src/libs/routes_v2/classroomCount.js index be2c8645ea06d53ec9a629b2912eefb7d2fd19af..ea649bbfdf6a88c9ffbf58aafd062bd619467c31 100644 --- a/src/libs/routes_v2/classroomCount.js +++ b/src/libs/routes_v2/classroomCount.js @@ -228,7 +228,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => { req.dims.state = true; req.dims.city = true; - //req.dims.school_year = true; + req.dims.school_year = true; req.dims.location = true; @@ -423,7 +423,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => { req.integral_time = {} for (let i = 0; i < integral_time_result.length; ++i){ // Se cidade não foi criada, cria - let integral_time = integral_time_result[i] + let integral_time = integral_time_result[i]; let code = '' + integral_time.year + integral_time.city_id if (req.dims.school) code = code + integral_time.school_id @@ -440,6 +440,8 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => { if (req.dims.school){ obj.school_id = integral_time.school_id obj.school_name = integral_time.school_name + obj.adm_dependency_id = integral_time.adm_dependency_id + obj.adm_dependency_name = integral_time.adm_dependency_name } req.integral_time[code] = obj currentCodeObj = obj; @@ -525,7 +527,9 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => { }; if (req.dims.school){ obj.school_id = classroom.school_id, - obj.school_name = classroom.school_name + obj.school_name = classroom.school_name, + obj.adm_dependency_id = classroom.adm_dependency_id, + obj.adm_dependency_name = classroom.adm_dependency_name } if (req.teacherCalc) obj.percentage_teacher_career = []; @@ -564,12 +568,13 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => { currentClassroomObj = obj; var id_attribute = req.dims.school ? "school_id" : "city_id" + var old_ti = ti; - while (ti < req.teacher.length && req.teacher[ti][id_attribute] !== classroom[id_attribute]) { // match da tabela de professores. + while (ti < req.teacher.length && req.teacher[ti][id_attribute] !== classroom[id_attribute]) // match da tabela de professores. ti++; - } - + if (ti === req.teacher.length) { + console.log(classroom[id_attribute], "not found") while (classroom[id_attribute] === enrollments[j][id_attribute]) enrollments.splice(j, 1) ti = old_ti; @@ -623,12 +628,13 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => { let enrollmentEducationLevel = req.educationSchoolYear[enrollment.school_year_id]; // Se não há um número de alunos por turna para a etapa de ensino, ignoramos a entrada - if(typeof enrollmentEducationLevel.numberStudentClass == 'undefined' || enrollmentEducationLevel.numberStudentClass == null) continue; + if(enrollmentEducationLevel.numberStudentClass == null) continue; // Adiciona nÃvel de educação para municÃpio/escola let educationLevel = null; if(!educationLevelSet.has(enrollmentEducationLevel.id)) { // cria e insere ordenadamente novo education level educationLevelSet.add(enrollmentEducationLevel.id); + let itHash = '' + enrollment.year + enrollment.city_id if (req.dims.school) itHash += enrollment.school_id @@ -695,7 +701,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => { let currentSchoolYear = null; if(enrollmentEducationLevel.id == 1){ let schoolYearHash = '' + enrollment.year + enrollment.city_id + enrollment.location_id + enrollment.school_year_id; - if (req.dims.shool) schoolYearHash = schoolYearHash + enrollment.school_id + if (req.dims.shool) schoolYearHash = schoolYearHash + enrollment.shcool_id if(schoolYearSet.has(schoolYearHash)) { // Busca a série escolar let k = 0;