From 3601c4b39b74b4c96e9f8bce8075f7907a897e95 Mon Sep 17 00:00:00 2001 From: Nathan Santos Date: Mon, 27 May 2024 10:38:25 -0300 Subject: [PATCH 1/8] fix: couldn't register the class on the absent day --- app/controllers/ClassesController.php | 24 ++++++++++++++++++++++-- js/classes/class-contents/functions.js | 23 ++++++++++++++++++++--- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/app/controllers/ClassesController.php b/app/controllers/ClassesController.php index b17f9e09d..ffb86e3c9 100755 --- a/app/controllers/ClassesController.php +++ b/app/controllers/ClassesController.php @@ -182,12 +182,32 @@ public function actionGetClassContents() "valid" => true, "classContents" => $classContents, "courseClasses" => $courseClasses, + "daysFaults" => $this->getInstructorFaultDays(Yii::app()->user->loginInfos->id) ]); } else { echo json_encode(["valid" => false, "error" => "Mês/Ano " . ($_POST["fundamentalMaior"] == "1" ? "e Disciplina" : "") . " sem aula no Quadro de Horário."]); } } + private function getInstructorFaultDays($instructorId) { + $featuresComponent = new FeaturesComponent(); + $isEnable = $featuresComponent->isEnable(strtoupper(INSTANCE)); + + if (true) { + $command = Yii::app()->db->createCommand(" + SELECT s.day + FROM instructor_faults if2 + JOIN schedule s ON if2.schedule_fk = s.id + WHERE if2.instructor_fk = (SELECT id from instructor_identification ii WHERE ii.users_fk = :instructor_id);" + ); + + $command->bindValue(':instructor_id', $instructorId); + $daysFaults = $command->queryColumn(); + + return $daysFaults; + } + } + /** * Summary of getSchedulesFromMajorStage @@ -487,8 +507,8 @@ public function actionGetFrequency() } array_push($students, $array); } - echo json_encode(["valid" => true, "students" => $students, "scheduleDays"=>$scheduleDays, "schedulePerDays"=>$schedulePerDays]); - + $daysFaults = $this->getInstructorFaultDays(Yii::app()->user->loginInfos->id); + echo json_encode(["valid" => true, "students" => $students, "scheduleDays" => $scheduleDays, "schedulePerDays"=>$schedulePerDays, "daysFaults" => $daysFaults]); } else { echo json_encode(["valid" => false, "error" => "Matricule alunos nesta turma para trazer o Quadro de Frequência."]); } diff --git a/js/classes/class-contents/functions.js b/js/classes/class-contents/functions.js index 7d1b3181b..0661d247f 100755 --- a/js/classes/class-contents/functions.js +++ b/js/classes/class-contents/functions.js @@ -13,6 +13,15 @@ function createTable(data) { accordionHtml += `
` $.each(data.classContents, function (day, classContent) { let studentInputs = ""; + + arrayFaults = []; + + if(data.daysFaults !== null){ + $.each(data.daysFaults, function (index, daysFaults) { + arrayFaults.push(parseInt(daysFaults, 10)); + }); + } + if (Object.keys(classContent.students).length) { $.each(classContent.students, function () { studentInputs += ""; @@ -39,14 +48,22 @@ function createTable(data) { } let head = '' + ((day < 10) ? '0' : '') + day + ''; + let disabledRow = (!classContent.available || arrayFaults.includes(parseInt(day, 10))) ? "disabled" : ""; + let body = '' + '' + studentInputs + '' - + '' + options - + '' - + ''; + + ''; + + if (arrayFaults.includes(parseInt(day, 10))) { + body += '
Não é possível registrar a aula, pois o professor não estava presente neste dia.
'; + } + + body += ''; + $('#class-contents > tbody').append('' + head + body + ''); let select = $("select.course-classes-select").last(); select.children("option").each(function () { From 2e88832109b605f60200f0140ad68692f4861c61 Mon Sep 17 00:00:00 2001 From: Nathan Santos Date: Wed, 12 Jun 2024 13:34:05 -0300 Subject: [PATCH 2/8] Fix: remove if not enabled icon class edit --- js/classes/class-contents/functions.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/classes/class-contents/functions.js b/js/classes/class-contents/functions.js index 0661d247f..b2dbdd646 100755 --- a/js/classes/class-contents/functions.js +++ b/js/classes/class-contents/functions.js @@ -52,9 +52,13 @@ function createTable(data) { let body = '' + '' - + studentInputs - + '' - + '' + options + ''; From a637799d809e7ea1bfe5997a217c52f2b8b8e36f Mon Sep 17 00:00:00 2001 From: Nathan Santos Date: Thu, 13 Jun 2024 08:33:47 -0300 Subject: [PATCH 3/8] Fix: frequency teacher day --- .../frequency/_initialization_instructor.js | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/js/classes/frequency/_initialization_instructor.js b/js/classes/frequency/_initialization_instructor.js index 5b09d244f..81bee8a5b 100644 --- a/js/classes/frequency/_initialization_instructor.js +++ b/js/classes/frequency/_initialization_instructor.js @@ -46,22 +46,36 @@ function generateStudentLines(data, dia, mes, ano, fundamentalMaior, monthSplit) }, ''); } function generateScheduleDays(data, monthSplit, fundamentalMaior) { + daysFaltsTeacher = data.daysFaults; + return data.scheduleDays.reduce((acc, scheduleDays) => { let dia = scheduleDays.day; let mes = monthSplit[1]; let ano = monthSplit[0]; - return acc + ` -
-
Aula do dia ${scheduleDays.date}
-
- + + if(daysFaltsTeacher.includes(dia)){ + acc += ` +
+
Professor(a) ausente para o dia: ${scheduleDays.date}
+
-
-
-
- ${generateStudentLines(data, dia, mes, ano, fundamentalMaior, monthSplit)} +
`; + }else{ + acc += ` +
+
Aula do dia ${scheduleDays.date}
+
+ +
-
`; +
+ + ${generateStudentLines(data, dia, mes, ano, fundamentalMaior, monthSplit)} +
+
`; + } + + return acc; }, ''); } @@ -104,6 +118,7 @@ function load() { $(function () { $("#accordion").accordion({ collapsible: true, + active: false, icons: null, }); }); From 0da1e4a134446fee0a9239ba9c25bdf8cc5b728e Mon Sep 17 00:00:00 2001 From: Nathan Santos Date: Tue, 18 Jun 2024 10:20:10 -0300 Subject: [PATCH 4/8] Fix: class diary --- .../views/default/_frequencyElementMobile.php | 53 +++++++++++++------ 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/app/modules/classdiary/views/default/_frequencyElementMobile.php b/app/modules/classdiary/views/default/_frequencyElementMobile.php index ae815729d..8255f979b 100644 --- a/app/modules/classdiary/views/default/_frequencyElementMobile.php +++ b/app/modules/classdiary/views/default/_frequencyElementMobile.php @@ -1,5 +1,25 @@ -
Para justificar falta e avaliação de Aluno clique no ícone
+
+ + Para justificar falta e avaliação de Aluno clique no ícone +
+ +db->createCommand(" + SELECT s.day + FROM instructor_faults if2 + JOIN schedule s ON if2.schedule_fk = s.id + WHERE if2.instructor_fk = (SELECT id from instructor_identification ii WHERE ii.users_fk = :instructor_id);" +); + +$command->bindValue(':instructor_id', 611); +$daysFaults = $command->queryColumn(); +$dateParts = explode('/', $date); +$usFormattedDate = $dateParts[1] . '/' . $dateParts[0] . '/' . $dateParts[2]; +$dayToCheck = date('j', strtotime($usFormattedDate)); + +if (!in_array($dayToCheck, $daysFaults)) { +?> @@ -12,19 +32,22 @@ - - createUrl('classdiary/default/StudentClassDiary', array('student_id' => $f["studentId"], 'stage_fk' => $stage_fk, 'classroom_id' => $classroom_fk, 'schedule' => $f["schedule"]["schedule"], 'date' => $date, 'discipline_fk' => $discipline_fk, "justification" => $f["schedule"]["justification"])) ; - $is_disabled = (!$f["schedule"]["available"] ? "disabled" : ""); - ?> - - - - - + createUrl('classdiary/default/StudentClassDiary', array('student_id' => $f["studentId"], 'stage_fk' => $stage_fk, 'classroom_id' => $classroom_fk, 'schedule' => $f["schedule"]["schedule"], 'date' => $date, 'discipline_fk' => $discipline_fk, "justification" => $f["schedule"]["justification"])) ; + $is_disabled = (!$f["schedule"]["available"] ? "disabled" : ""); + ?> + + + + +
>" type='checkbox' - data-studentId='' data-classroom_id='' data-stage_fk='' data-schedule=''/>
>" type='checkbox' + data-studentId='' data-classroom_id='' data-stage_fk='' data-schedule=''/>
- -
- \ No newline at end of file + +Professor ausente para este dia
'; +} +endif; +?> From 7c9f572738c11b1de12e93055c17e494b4efd1a6 Mon Sep 17 00:00:00 2001 From: Nathan Santos Date: Fri, 21 Jun 2024 16:44:22 -0300 Subject: [PATCH 5/8] Fix: fixed id user --- .../classdiary/views/default/_frequencyElementMobile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/modules/classdiary/views/default/_frequencyElementMobile.php b/app/modules/classdiary/views/default/_frequencyElementMobile.php index 8255f979b..184783312 100644 --- a/app/modules/classdiary/views/default/_frequencyElementMobile.php +++ b/app/modules/classdiary/views/default/_frequencyElementMobile.php @@ -12,7 +12,7 @@ WHERE if2.instructor_fk = (SELECT id from instructor_identification ii WHERE ii.users_fk = :instructor_id);" ); -$command->bindValue(':instructor_id', 611); +$command->bindValue(':instructor_id', Yii::app()->user->loginInfos->id); $daysFaults = $command->queryColumn(); $dateParts = explode('/', $date); $usFormattedDate = $dateParts[1] . '/' . $dateParts[0] . '/' . $dateParts[2]; From fdf87b679b4e71ab359b5a0e449c50005ee19435 Mon Sep 17 00:00:00 2001 From: Nathan Santos Date: Thu, 11 Jul 2024 15:03:53 -0300 Subject: [PATCH 6/8] Feat: added ienable for database muribeca --- app/controllers/ClassesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/ClassesController.php b/app/controllers/ClassesController.php index ffb86e3c9..43f62edc7 100755 --- a/app/controllers/ClassesController.php +++ b/app/controllers/ClassesController.php @@ -193,7 +193,7 @@ private function getInstructorFaultDays($instructorId) { $featuresComponent = new FeaturesComponent(); $isEnable = $featuresComponent->isEnable(strtoupper(INSTANCE)); - if (true) { + if ($isEnable) { $command = Yii::app()->db->createCommand(" SELECT s.day FROM instructor_faults if2 From 520c6ba73bb629d43f5b655f519c05bf18c3b183 Mon Sep 17 00:00:00 2001 From: Nathan Santos Date: Thu, 11 Jul 2024 15:11:22 -0300 Subject: [PATCH 7/8] Feat: added migration --- app/migrations/2024-07-11_frequency_teacher/sql.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 app/migrations/2024-07-11_frequency_teacher/sql.sql diff --git a/app/migrations/2024-07-11_frequency_teacher/sql.sql b/app/migrations/2024-07-11_frequency_teacher/sql.sql new file mode 100644 index 000000000..c82b7d7bb --- /dev/null +++ b/app/migrations/2024-07-11_frequency_teacher/sql.sql @@ -0,0 +1,2 @@ +INSERT INTO instance_config (parameter_key,parameter_name,value) +VALUES ('MURIBECA.TAG.ONG.BR','Proibir registro de aula por professor ausente no dia da falta','1'); \ No newline at end of file From 52841efd2d6a950ef8b4cc45f5ce74278c79054a Mon Sep 17 00:00:00 2001 From: Nathan Santos Date: Thu, 11 Jul 2024 15:30:05 -0300 Subject: [PATCH 8/8] Feat: added new version for changelog and config --- CHANGELOG.md | 3 +++ config.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f34999686..ee681ece0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [Versão 3.81.173] +- Validações foram realizadas para impedir que professores registrem suas aulas nos dias em que estiveram ausentes + ## [Versão 3.81.172] - Adicionado Sábado letivo aos cardápios diff --git a/config.php b/config.php index 4b3842bb9..db8e2f0ab 100644 --- a/config.php +++ b/config.php @@ -4,7 +4,7 @@ $debug = getenv("YII_DEBUG"); defined('YII_DEBUG') or define('YII_DEBUG', $debug); -define("TAG_VERSION", '3.81.172'); +define("TAG_VERSION", '3.81.173'); define("YII_VERSION", Yii::getVersion()); define("BOARD_MSG", '
Novas atualizações no TAG. Confira clicando aqui.
');