Skip to content
Snippets Groups Projects

V1.8.0

Merged Fernando Erd requested to merge v1.8.0 into master
1 file
+ 9
8
Compare changes
  • Side-by-side
  • Inline
@@ -163,8 +163,6 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
@@ -163,8 +163,6 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
let classSize = JSON.parse(req.body.class_size) || null;
let classSize = JSON.parse(req.body.class_size) || null;
let integralTime = JSON.parse(req.body.integral_time) || null;
let integralTime = JSON.parse(req.body.integral_time) || null;
console.log(classSize, integralTime);
if(classSize == null || integralTime == null) {
if(classSize == null || integralTime == null) {
res.statusCode = 400;
res.statusCode = 400;
return res.json({err: {message: "There was an error processing class_size or integral_time. Check your JSON sintax and be sure you're sending both paramenters."}});
return res.json({err: {message: "There was an error processing class_size or integral_time. Check your JSON sintax and be sure you're sending both paramenters."}});
@@ -197,7 +195,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
@@ -197,7 +195,7 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
if(id2str.schoolYear(i) !== id2str.schoolYear(99)) {
if(id2str.schoolYear(i) !== id2str.schoolYear(99)) {
let educationLevelId = Math.floor(i/10);
let educationLevelId = Math.floor(i/10);
let classSize = req.classSize.find((el) => {return el.id === educationLevelId});
let classSize = req.classSize.find((el) => {return el.id === educationLevelId || el.id === i});
let integralTime = req.integralTime.find((el) => {return el.id === educationLevelId});
let integralTime = req.integralTime.find((el) => {return el.id === educationLevelId});
let numberStudentClass = (typeof classSize !== 'undefined') ? classSize.numberStudentClass : null;
let numberStudentClass = (typeof classSize !== 'undefined') ? classSize.numberStudentClass : null;
@@ -412,19 +410,22 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
@@ -412,19 +410,22 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
}
}
}
}
 
let currentOfferGoal = enrollmentEducationLevel.offerGoal;
 
let currentNumberStudentClass = (enrollment.location_id == 1) ? enrollmentEducationLevel.numberStudentClass.urban : enrollmentEducationLevel.numberStudentClass.country;
 
// Soma os totais de matrícula da etapa de ensino
// Soma os totais de matrícula da etapa de ensino
educationLevel.enrollment.total_enrollment_day += (enrollment.period_id < 3 && enrollment.period_id != null) ? enrollment.total : 0;
educationLevel.enrollment.total_enrollment_day += (enrollment.period_id < 3 && enrollment.period_id != null) ? enrollment.total : 0;
educationLevel.enrollment.total_enrollment_night += (enrollment.period_id == 3) ? enrollment.total : 0;
educationLevel.enrollment.total_enrollment_night += (enrollment.period_id == 3) ? enrollment.total : 0;
// Calcula o número de turmas parcial
// Calcula o número de turmas parcial
// Turmas de período integral
// Turmas de período integral
educationLevel.enrollment.full_period_classes = Math.ceil((educationLevel.enrollment.total_enrollment_day * (enrollmentEducationLevel.offerGoal/100)) / enrollmentEducationLevel.numberStudentClass);
educationLevel.enrollment.full_period_classes = Math.ceil((educationLevel.enrollment.total_enrollment_day * (currentOfferGoal/100)) / currentNumberStudentClass);
// Turmas diurnas (matrículas diurnas - matrículas integrais)
// Turmas diurnas (matrículas diurnas - matrículas integrais)
educationLevel.enrollment.day_classes = Math.ceil((educationLevel.enrollment.total_enrollment_day * (1 - enrollmentEducationLevel.offerGoal/100)) / enrollmentEducationLevel.numberStudentClass);
educationLevel.enrollment.day_classes = Math.ceil((educationLevel.enrollment.total_enrollment_day * (1 - currentOfferGoal/100)) / currentNumberStudentClass);
// Turmas noturnas
// Turmas noturnas
educationLevel.enrollment.night_classes = Math.ceil((educationLevel.enrollment.total_enrollment_night / enrollmentEducationLevel.numberStudentClass));
educationLevel.enrollment.night_classes = Math.ceil((educationLevel.enrollment.total_enrollment_night / currentNumberStudentClass));
// Total de salas
// Total de salas
educationLevel.enrollment.total_classrooms_needed = (educationLevel.enrollment.full_period_classes + educationLevel.enrollment.day_classes/2);
educationLevel.enrollment.total_classrooms_needed = (educationLevel.enrollment.full_period_classes + educationLevel.enrollment.day_classes/2);
@@ -440,9 +441,9 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
@@ -440,9 +441,9 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
currentSchoolYear.total_enrollment_night += (enrollment.period_id == 3) ? enrollment.total : 0;
currentSchoolYear.total_enrollment_night += (enrollment.period_id == 3) ? enrollment.total : 0;
// Número de turmas parcial
// Número de turmas parcial
currentSchoolYear.full_period_classes = Math.ceil((currentSchoolYear.total_enrollment_day * (enrollmentEducationLevel.offerGoal/100)) / enrollmentEducationLevel.numberStudentClass);
currentSchoolYear.full_period_classes = Math.ceil((currentSchoolYear.total_enrollment_day * (currentOfferGoal/100)) / currentNumberStudentClass);
currentSchoolYear.day_classes = Math.ceil((currentSchoolYear.total_enrollment_day * (1 - enrollmentEducationLevel.offerGoal/100)) / enrollmentEducationLevel.numberStudentClass);
currentSchoolYear.day_classes = Math.ceil((currentSchoolYear.total_enrollment_day * (1 - currentOfferGoal/100)) / currentNumberStudentClass);
currentSchoolYear.night_classes = Math.ceil((currentSchoolYear.total_enrollment_night / enrollmentEducationLevel.numberStudentClass));
currentSchoolYear.night_classes = Math.ceil((currentSchoolYear.total_enrollment_night / enrollmentEducationLevel.numberStudentClass));
Loading