From 7631b576f431e672a97dad6442dd51741189682b Mon Sep 17 00:00:00 2001 From: fgs21 <fgs21@inf.ufpr.br> Date: Mon, 5 Jun 2023 10:28:57 -0300 Subject: [PATCH] trying to use the old version of classroom count --- src/libs/routes_v2/classroomCount.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/libs/routes_v2/classroomCount.js b/src/libs/routes_v2/classroomCount.js index 47ea5e78..ea649bbf 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 @@ -568,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; @@ -627,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 @@ -699,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; -- GitLab