@@ -356,20 +352,28 @@ function saveUnities(reply) {
),
operation: $(".final-recovery-unity-operation").val(),
},
- semianualRecovery: {
- id: $(".semianual-unity-id").val(),
- nameOne: $(".one-semianual-unity-name").val(),
- nameTwo: $(".two-semianual-unity-name").val(),
- type: $(".semianual-unity-type").val(),
- unityOne: $("#semianual-modality-first").val(),
- unityTwo: $("#semianual-modality-second").val(),
- grade_calculation_fk: $(".calculation-final-media").select2(
- "val"
- ),
- operation: $(".semianual-unity-operation").val(),
- },
+ semianualRecovery: [
+ {
+ id: $(".semianual-unity-id").val(),
+ name: $(".two-semianual-unity-name").val(),
+ type: $(".semianual-unity-type").val(),
+ grade_calculation_fk: $(".semianual-recovery-unity-calculation").select2(
+ "val"
+ ),
+ operation: $(".semianual-unity-operation").val(),
+ },
+ {
+ id: $(".semianual-unity-id").val(),
+ name: $(".one-semianual-unity-name").val(),
+ type: $(".semianual-unity-type").val(),
+ grade_calculation_fk: $(".semianual-recovery-unity-calculation").select2(
+ "val"
+ ),
+ operation: $(".semianual-unity-operation").val(),
+ },
+ ],
finalRecoverMedia: $(".final-recover-media").val(),
- semianualRecoverMedia: $(".semianual-unity-media").val(),
+ semiRecoverMedia: $(".semianual-unity-media").val(),
finalMediaCalculation: $(".calculation-final-media").select2("val"),
reply: reply ? $(".reply-option:checked").val() : "",
ruleType: $(".js-rule-type").select2("val"),
@@ -610,7 +614,7 @@ function loadStructure() {
console.log(data);
- dataUnities.forEach(function([id, name]) {
+ dataUnities.forEach(function ([id, name]) {
const optionFirst = $('
', {
value: id,
text: name
From 8838a5966faa50396dfa85b9bbbe33c9f8f2da6f Mon Sep 17 00:00:00 2001
From: Evellyn Jade <97754536+evellynreis@users.noreply.github.com>
Date: Mon, 26 Feb 2024 12:05:23 -0300
Subject: [PATCH 10/19] feat/refatoring method save unities add method
processSemianualRecovey
---
app/controllers/AdminController.php | 59 +++++++++++++++--------------
js/admin/grades-structure.js | 6 +--
2 files changed, 33 insertions(+), 32 deletions(-)
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 93d93b533..3056d7044 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -293,7 +293,6 @@ public function actionSaveUnities()
$usecase->exec();
if ($hasFinalRecovery === true) {
-
$recoveryUnity = GradeUnity::model()->find($finalRecovery["id"]);
if ($finalRecovery["operation"] === "delete") {
@@ -313,40 +312,14 @@ public function actionSaveUnities()
if (!$recoveryUnity->validate()) {
$validationMessage = Yii::app()->utils->stringfyValidationErrors($recoveryUnity);
- throw new CHttpException(400, "Não foi possivel salvar dados da recuperação final: \n" . $validationMessage, 1);
+ throw new CHttpException(400, "Não foi possível salvar dados da recuperação final: \n" . $validationMessage, 1);
}
$recoveryUnity->save();
}
if ($hasSemianualRecovery === true) {
-
- foreach ($semiRecovery as $semianual) {
- $recoveryUnitySemi = new GradeUnity();
-
- if ($semianual["operation"] === "update") {
- $recoveryUnitySemi = GradeUnity::model()->find($semianual["id"]);
- }
-
- if ($semianual["operation"] === "delete") {
- $recoveryUnitySemi = GradeUnity::model()->find($semianual["id"]);
- $recoveryUnitySemi->delete();
- echo json_encode(["valid" => true]);
- Yii::app()->end();
- }
-
- $recoveryUnitySemi->name = $semianual["name"];
- $recoveryUnitySemi->type = "RS";
- $recoveryUnitySemi->grade_calculation_fk = $semianual["grade_calculation_fk"];
- $recoveryUnitySemi->edcenso_stage_vs_modality_fk = $stage;
-
- if (!$recoveryUnitySemi->validate()) {
- $validationMessage = Yii::app()->utils->stringfyValidationErrors($recoveryUnitySemi);
- throw new CHttpException(400, "Não foi possivel salvar dados da recuperação semestral: \n" . $validationMessage, 1);
- }
-
- $recoveryUnitySemi->save();
- }
+ $this->processSemianualRecovery($stage, $semiRecovery);
}
echo json_encode(["valid" => true]);
@@ -358,7 +331,35 @@ public function actionSaveUnities()
}
}
+ protected function processSemianualRecovery($stage, $semiRecovery)
+ {
+ foreach ($semiRecovery as $semianual) {
+ $recoveryUnitySemi = new GradeUnity();
+
+ if ($semianual["operation"] === "update") {
+ $recoveryUnitySemi = GradeUnity::model()->find($semianual["id"]);
+ }
+
+ if ($semianual["operation"] === "delete") {
+ $recoveryUnitySemi = GradeUnity::model()->find($semianual["id"]);
+ $recoveryUnitySemi->delete();
+ echo json_encode(["valid" => true]);
+ Yii::app()->end();
+ }
+ $recoveryUnitySemi->name = $semianual["name"];
+ $recoveryUnitySemi->type = "RS";
+ $recoveryUnitySemi->grade_calculation_fk = $semianual["grade_calculation_fk"];
+ $recoveryUnitySemi->edcenso_stage_vs_modality_fk = $stage;
+
+ if (!$recoveryUnitySemi->validate()) {
+ $validationMessage = Yii::app()->utils->stringfyValidationErrors($recoveryUnitySemi);
+ throw new CHttpException(400, "Não foi possível salvar dados da recuperação semestral: \n" . $validationMessage, 1);
+ }
+
+ $recoveryUnitySemi->save();
+ }
+ }
public function actionActiveDisableUser()
{
diff --git a/js/admin/grades-structure.js b/js/admin/grades-structure.js
index 27e0124ed..bcdc57c98 100644
--- a/js/admin/grades-structure.js
+++ b/js/admin/grades-structure.js
@@ -355,7 +355,7 @@ function saveUnities(reply) {
semianualRecovery: [
{
id: $(".semianual-unity-id").val(),
- name: $(".two-semianual-unity-name").val(),
+ name: $(".one-semianual-unity-name").val(),
type: $(".semianual-unity-type").val(),
grade_calculation_fk: $(".semianual-recovery-unity-calculation").select2(
"val"
@@ -364,13 +364,13 @@ function saveUnities(reply) {
},
{
id: $(".semianual-unity-id").val(),
- name: $(".one-semianual-unity-name").val(),
+ name: $(".two-semianual-unity-name").val(),
type: $(".semianual-unity-type").val(),
grade_calculation_fk: $(".semianual-recovery-unity-calculation").select2(
"val"
),
operation: $(".semianual-unity-operation").val(),
- },
+ }
],
finalRecoverMedia: $(".final-recover-media").val(),
semiRecoverMedia: $(".semianual-unity-media").val(),
From 039c21a0ab2484f1170dad3dcfe3be0b016df812 Mon Sep 17 00:00:00 2001
From: Evellyn Jade <97754536+evellynreis@users.noreply.github.com>
Date: Tue, 27 Feb 2024 10:55:12 -0300
Subject: [PATCH 11/19] feat/id semianual-unity-media and usecase
---
app/controllers/AdminController.php | 4 ++++
.../usecases/UpdateGradeJustOneStructUsecase.php | 5 ++++-
.../admin/usecases/UpdateGradeStructUsecase.php | 13 +++++++++----
js/admin/grades-structure.js | 4 +++-
themes/default/views/admin/gradesStructure.php | 2 +-
5 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 3056d7044..a6269033f 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -253,6 +253,7 @@ public function actionGetUnities()
$result["approvalMedia"] = $gradeRules->approvation_media;
$result["finalRecoverMedia"] = $gradeRules->final_recover_media;
+ $result["semiRecoverMedia"] = $gradeRules->semi_recover_media;
$result["mediaCalculation"] = $gradeRules->grade_calculation_fk;
$result["ruleType"] = $gradeRules->rule_type;
$result["hasFinalRecovery"] = (bool) $gradeRules->has_final_recovery;
@@ -271,6 +272,7 @@ public function actionSaveUnities()
$unities = Yii::app()->request->getPost("unities");
$approvalMedia = Yii::app()->request->getPost("approvalMedia");
$finalRecoverMedia = Yii::app()->request->getPost("finalRecoverMedia");
+ $semiRecoverMedia = Yii::app()->request->getPost("semiRecoverMedia");
$calculationFinalMedia = Yii::app()->request->getPost("finalMediaCalculation");
$finalRecovery = Yii::app()->request->getPost("finalRecovery");
$semiRecovery = Yii::app()->request->getPost("semianualRecovery");
@@ -285,6 +287,7 @@ public function actionSaveUnities()
$unities,
$approvalMedia,
$finalRecoverMedia,
+ $semiRecoverMedia,
$calculationFinalMedia,
$hasFinalRecovery,
$hasSemianualRecovery,
@@ -349,6 +352,7 @@ protected function processSemianualRecovery($stage, $semiRecovery)
$recoveryUnitySemi->name = $semianual["name"];
$recoveryUnitySemi->type = "RS";
+ $recoveryUnitySemi
$recoveryUnitySemi->grade_calculation_fk = $semianual["grade_calculation_fk"];
$recoveryUnitySemi->edcenso_stage_vs_modality_fk = $stage;
diff --git a/app/domain/admin/usecases/UpdateGradeJustOneStructUsecase.php b/app/domain/admin/usecases/UpdateGradeJustOneStructUsecase.php
index c7677a6b6..686bc23af 100644
--- a/app/domain/admin/usecases/UpdateGradeJustOneStructUsecase.php
+++ b/app/domain/admin/usecases/UpdateGradeJustOneStructUsecase.php
@@ -9,6 +9,7 @@
* @property [] $unities
* @property mixed $approvalMedia
* @property mixed $finalRecoverMedia
+ * @property mixed $semiRecoverMedia
* @property mixed $calculationFinalMedia
* @property bool $hasFinalRecovery
* @property string $ruleType
@@ -19,12 +20,13 @@ class UpdateGradeJustOneStructUsecase
private const OP_UPDATE = "update";
private const OP_REMOVE = "remove";
- public function __construct($stage, $unities, $approvalMedia, $finalRecoverMedia, $calculationFinalMedia, $hasFinalRecovery, $ruleType)
+ public function __construct($stage, $unities, $approvalMedia, $finalRecoverMedia, $semiRecoverMedia, $calculationFinalMedia, $hasFinalRecovery, $ruleType)
{
$this->stage = $stage;
$this->unities = $unities;
$this->approvalMedia = $approvalMedia;
$this->finalRecoverMedia = $finalRecoverMedia;
+ $this->semiRecoverMedia = $semiRecoverMedia;
$this->calculationFinalMedia = $calculationFinalMedia;
$this->hasFinalRecovery = $hasFinalRecovery;
$this->ruleType = $ruleType;
@@ -41,6 +43,7 @@ public function exec()
$this->stage,
$this->approvalMedia,
$this->finalRecoverMedia,
+ $this->semiRecoverMedia,
$this->calculationFinalMedia,
$this->hasFinalRecovery,
$this->ruleType
diff --git a/app/domain/admin/usecases/UpdateGradeStructUsecase.php b/app/domain/admin/usecases/UpdateGradeStructUsecase.php
index c3ea45262..0a9db88da 100644
--- a/app/domain/admin/usecases/UpdateGradeStructUsecase.php
+++ b/app/domain/admin/usecases/UpdateGradeStructUsecase.php
@@ -8,6 +8,8 @@
* @property [] $unities
* @property mixed $approvalMedia
* @property mixed $finalRecoverMedia
+ * @property mixed $semiRecoverMedia
+ * @property mixed $calculationFinalMedia
* @property mixed $calcFinalMedia
* @property bool $hasFinalRecovery
* @property string $ruleType
@@ -18,13 +20,14 @@ class UpdateGradeStructUsecase
private const ALL_STAGES = "A";
private const STAGES_FROM_SAME_MODALITY = "S";
- public function __construct($reply, $stage, $unities, $approvalMedia, $finalRecoverMedia, $calcFinalMedia, $hasFinalRecovery, $ruleType)
+ public function __construct($reply, $stage, $unities, $approvalMedia, $finalRecoverMedia, $semiRecoverMedia, $calcFinalMedia, $hasFinalRecovery, $ruleType)
{
$this->reply = $reply;
$this->stage = $stage;
$this->unities = $unities;
$this->approvalMedia = $approvalMedia;
$this->finalRecoverMedia = $finalRecoverMedia;
+ $this->semiRecoverMedia = $semiRecoverMedia;
$this->calculationFinalMedia = $calcFinalMedia;
$this->hasFinalRecovery = $hasFinalRecovery;
$this->ruleType = $ruleType;
@@ -38,6 +41,7 @@ public function exec()
$this->unities,
$this->approvalMedia,
$this->finalRecoverMedia,
+ $this->semiRecoverMedia,
$this->calculationFinalMedia,
$this->hasFinalRecovery,
$this->ruleType
@@ -46,15 +50,15 @@ public function exec()
} elseif ($this->reply === self::ALL_STAGES) {
// A = Toda a Matriz Curricular
$matrixes = $this->getAllMatrixes();
- $this->saveAndReplayForSimliarStages($matrixes, $this->unities, $this->approvalMedia, $this->finalRecoverMedia, $this->calculationFinalMedia, $this->hasFinalRecovery, $this->ruleType);
+ $this->saveAndReplayForSimliarStages($matrixes, $this->unities, $this->approvalMedia, $this->finalRecoverMedia, $this->semiRecoverMedia, $this->calculationFinalMedia, $this->hasFinalRecovery, $this->ruleType);
} elseif ($this->reply === self::STAGES_FROM_SAME_MODALITY) {
// S = Todas as etapas de a modalidade selecionada.
$stages = $this->getMatrixesForAllModalities($this->stage);
- $this->saveAndReplayForSimliarStages($stages, $this->unities, $this->approvalMedia, $this->finalRecoverMedia, $this->calculationFinalMedia, $this->hasFinalRecovery, $this->ruleType);
+ $this->saveAndReplayForSimliarStages($stages, $this->unities, $this->approvalMedia, $this->finalRecoverMedia, $this->semiRecoverMedia, $this->calculationFinalMedia, $this->hasFinalRecovery, $this->ruleType);
}
}
- private function saveAndReplayForSimliarStages($stages, $unities, $approvalMedia, $finalRecoverMedia, $calcFinalMedia, $hasFinalRecovery, $ruleType)
+ private function saveAndReplayForSimliarStages($stages, $unities, $approvalMedia, $finalRecoverMedia, $semiRecoverMedia, $calcFinalMedia, $hasFinalRecovery, $ruleType)
{
foreach ($stages as $stage) {
$justOneUsecase = new UpdateGradeJustOneStructUsecase(
@@ -62,6 +66,7 @@ private function saveAndReplayForSimliarStages($stages, $unities, $approvalMedia
$unities,
$approvalMedia,
$finalRecoverMedia,
+ $semiRecoverMedia,
$calcFinalMedia,
$hasFinalRecovery,
$ruleType
diff --git a/js/admin/grades-structure.js b/js/admin/grades-structure.js
index bcdc57c98..07e286c72 100644
--- a/js/admin/grades-structure.js
+++ b/js/admin/grades-structure.js
@@ -373,7 +373,7 @@ function saveUnities(reply) {
}
],
finalRecoverMedia: $(".final-recover-media").val(),
- semiRecoverMedia: $(".semianual-unity-media").val(),
+ semiRecoverMedia: $("#semianual-unity-media").val(),
finalMediaCalculation: $(".calculation-final-media").select2("val"),
reply: reply ? $(".reply-option:checked").val() : "",
ruleType: $(".js-rule-type").select2("val"),
@@ -594,6 +594,7 @@ function loadStructure() {
);
$(".js-rule-type").select2("val", data.ruleType);
$(".final-recover-media").val(data.finalRecoverMedia);
+ $("#semianual-unity-media").val(data.semiRecoverMedia);
$(".final-recovery-unity-operation").val(
data.final_recovery !== null ? "update" : "create"
);
@@ -628,6 +629,7 @@ function loadStructure() {
});
$(".final-recover-media").val(data.finalRecoverMedia);
+ $(".semiRecoverMedia").val(data.semiRecoverMedia);
if (data.hasFinalRecovery) {
$(".js-recovery-form").show();
diff --git a/themes/default/views/admin/gradesStructure.php b/themes/default/views/admin/gradesStructure.php
index 0eaeb64e9..a336d4c2b 100644
--- a/themes/default/views/admin/gradesStructure.php
+++ b/themes/default/views/admin/gradesStructure.php
@@ -138,7 +138,7 @@ class="grades-structure-container t-accordeon-quaternary js-grades-structure-con
Média de Rec. Semestral
-
+
From b2d37939fd1483017a82814c0417a3d2ed1c7c5b Mon Sep 17 00:00:00 2001
From: Evellyn Jade <97754536+evellynreis@users.noreply.github.com>
Date: Wed, 28 Feb 2024 09:56:58 -0300
Subject: [PATCH 12/19] feat/modify grade rules semi recovery media
---
app/controllers/AdminController.php | 8 +++++---
.../admin/usecases/UpdateGradeJustOneStructUsecase.php | 7 ++++---
app/domain/admin/usecases/UpdateGradeRulesUsecase.php | 7 ++++++-
app/domain/admin/usecases/UpdateGradeStructUsecase.php | 5 ++++-
app/models/GradeRules.php | 10 ++++++----
5 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index a6269033f..181c7f4d6 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -322,7 +322,7 @@ public function actionSaveUnities()
}
if ($hasSemianualRecovery === true) {
- $this->processSemianualRecovery($stage, $semiRecovery);
+ $this->processSemianualRecovery($stage, $semiRecovery, $semiRecoverMedia);
}
echo json_encode(["valid" => true]);
@@ -334,10 +334,11 @@ public function actionSaveUnities()
}
}
- protected function processSemianualRecovery($stage, $semiRecovery)
+ protected function processSemianualRecovery($stage, $semiRecovery, $semiRecoverMedia)
{
foreach ($semiRecovery as $semianual) {
$recoveryUnitySemi = new GradeUnity();
+ $gradeRules = new GradeRules();
if ($semianual["operation"] === "update") {
$recoveryUnitySemi = GradeUnity::model()->find($semianual["id"]);
@@ -352,9 +353,10 @@ protected function processSemianualRecovery($stage, $semiRecovery)
$recoveryUnitySemi->name = $semianual["name"];
$recoveryUnitySemi->type = "RS";
- $recoveryUnitySemi
+ // $recoveryUnitySemi
$recoveryUnitySemi->grade_calculation_fk = $semianual["grade_calculation_fk"];
$recoveryUnitySemi->edcenso_stage_vs_modality_fk = $stage;
+ $gradeRules->semi_recover_media = $semiRecoverMedia;
if (!$recoveryUnitySemi->validate()) {
$validationMessage = Yii::app()->utils->stringfyValidationErrors($recoveryUnitySemi);
diff --git a/app/domain/admin/usecases/UpdateGradeJustOneStructUsecase.php b/app/domain/admin/usecases/UpdateGradeJustOneStructUsecase.php
index 686bc23af..c7fd1053a 100644
--- a/app/domain/admin/usecases/UpdateGradeJustOneStructUsecase.php
+++ b/app/domain/admin/usecases/UpdateGradeJustOneStructUsecase.php
@@ -12,6 +12,7 @@
* @property mixed $semiRecoverMedia
* @property mixed $calculationFinalMedia
* @property bool $hasFinalRecovery
+ * @property bool $hasSemianualRecovery
* @property string $ruleType
*/
class UpdateGradeJustOneStructUsecase
@@ -20,7 +21,7 @@ class UpdateGradeJustOneStructUsecase
private const OP_UPDATE = "update";
private const OP_REMOVE = "remove";
- public function __construct($stage, $unities, $approvalMedia, $finalRecoverMedia, $semiRecoverMedia, $calculationFinalMedia, $hasFinalRecovery, $ruleType)
+ public function __construct($stage, $unities, $approvalMedia, $finalRecoverMedia, $semiRecoverMedia, $calculationFinalMedia, $hasFinalRecovery, $hasSemianualRecovery, $ruleType)
{
$this->stage = $stage;
$this->unities = $unities;
@@ -29,6 +30,7 @@ public function __construct($stage, $unities, $approvalMedia, $finalRecoverMedia
$this->semiRecoverMedia = $semiRecoverMedia;
$this->calculationFinalMedia = $calculationFinalMedia;
$this->hasFinalRecovery = $hasFinalRecovery;
+ $this->hasSemianualRecovery = $hasSemianualRecovery;
$this->ruleType = $ruleType;
}
@@ -46,10 +48,10 @@ public function exec()
$this->semiRecoverMedia,
$this->calculationFinalMedia,
$this->hasFinalRecovery,
+ $this->hasSemianualRecovery,
$this->ruleType
);
$rulesUseCase->exec();
-
}
@@ -104,7 +106,6 @@ private function buildAvaliationModalities($unity, $modalities)
}
$modalityModel->save();
-
} elseif ($m["operation"] === self::OP_REMOVE) {
GradeUnityModality::model()->deleteByPk($m["id"]);
}
diff --git a/app/domain/admin/usecases/UpdateGradeRulesUsecase.php b/app/domain/admin/usecases/UpdateGradeRulesUsecase.php
index f42f5d9f4..1350cae13 100644
--- a/app/domain/admin/usecases/UpdateGradeRulesUsecase.php
+++ b/app/domain/admin/usecases/UpdateGradeRulesUsecase.php
@@ -8,19 +8,23 @@
* @property int $stage
* @property float $approvalMedia
* @property float $finalRecoverMedia
+ * @property float $semiRecoverMedia
* @property int $calcFinalMedia
* @property bool $hasFinalRecovery
+ * @property bool $hasSemianualRecovery
* @property string $ruleType
*/
class UpdateGradeRulesUsecase
{
- public function __construct($stage, $approvalMedia, $finalRecoverMedia, $calcFinalMedia, $hasFinalRecovery, $ruleType)
+ public function __construct($stage, $approvalMedia, $finalRecoverMedia, $semiRecoverMedia, $calcFinalMedia, $hasFinalRecovery,$hasSemianualRecovery, $ruleType)
{
$this->stage = $stage;
$this->approvalMedia = $approvalMedia;
$this->finalRecoverMedia = $finalRecoverMedia;
+ $this->semiRecoverMedia = $semiRecoverMedia;
$this->calcFinalMedia = $calcFinalMedia;
$this->hasFinalRecovery = $hasFinalRecovery;
+ $this->hasSemianualRecovery = $hasSemianualRecovery;
$this->ruleType = $ruleType;
}
@@ -40,6 +44,7 @@ public function exec()
$gradeRules->grade_calculation_fk = $this->calcFinalMedia;
$gradeRules->has_final_recovery = (int) $this->hasFinalRecovery;
$gradeRules->rule_type = $this->ruleType;
+ $gradeRules->semi_recover_media = $this->semiRecoverMedia;
if(!$gradeRules->validate()){
Yii::log(TagUtils::stringfyValidationErrors($gradeRules), CLogger::LEVEL_ERROR);
diff --git a/app/domain/admin/usecases/UpdateGradeStructUsecase.php b/app/domain/admin/usecases/UpdateGradeStructUsecase.php
index 0a9db88da..d75eb2dce 100644
--- a/app/domain/admin/usecases/UpdateGradeStructUsecase.php
+++ b/app/domain/admin/usecases/UpdateGradeStructUsecase.php
@@ -12,6 +12,7 @@
* @property mixed $calculationFinalMedia
* @property mixed $calcFinalMedia
* @property bool $hasFinalRecovery
+ * @property bool $hasSemianualRecovery
* @property string $ruleType
*/
class UpdateGradeStructUsecase
@@ -20,7 +21,7 @@ class UpdateGradeStructUsecase
private const ALL_STAGES = "A";
private const STAGES_FROM_SAME_MODALITY = "S";
- public function __construct($reply, $stage, $unities, $approvalMedia, $finalRecoverMedia, $semiRecoverMedia, $calcFinalMedia, $hasFinalRecovery, $ruleType)
+ public function __construct($reply, $stage, $unities, $approvalMedia, $finalRecoverMedia, $semiRecoverMedia, $calcFinalMedia, $hasFinalRecovery, $hasSemianualRecovery, $ruleType)
{
$this->reply = $reply;
$this->stage = $stage;
@@ -30,6 +31,7 @@ public function __construct($reply, $stage, $unities, $approvalMedia, $finalReco
$this->semiRecoverMedia = $semiRecoverMedia;
$this->calculationFinalMedia = $calcFinalMedia;
$this->hasFinalRecovery = $hasFinalRecovery;
+ $this->hasSemianualRecovery = $hasSemianualRecovery;
$this->ruleType = $ruleType;
}
@@ -44,6 +46,7 @@ public function exec()
$this->semiRecoverMedia,
$this->calculationFinalMedia,
$this->hasFinalRecovery,
+ $this->hasSemianualRecovery,
$this->ruleType
);
$justOneUsecase->exec();
diff --git a/app/models/GradeRules.php b/app/models/GradeRules.php
index 324e3b9e6..5a85612ce 100644
--- a/app/models/GradeRules.php
+++ b/app/models/GradeRules.php
@@ -11,6 +11,7 @@
* @property integer $grade_calculation_fk
* @property integer $has_final_recovery
* @property string $rule_type
+ * @property integer $semi_recover_media
*
* The followings are the available model relations:
* @property GradeCalculation $gradeCalculationFk
@@ -34,14 +35,13 @@ public function rules()
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
- array('edcenso_stage_vs_modality_fk', 'required'),
- array('approvation_media', 'required', 'on' => "numericGrade"),
- array('edcenso_stage_vs_modality_fk, grade_calculation_fk, has_final_recovery', 'numerical', 'integerOnly'=>true),
+ array('edcenso_stage_vs_modality_fk, approvation_media, final_recover_media, semi_recover_media', 'required'),
+ array('edcenso_stage_vs_modality_fk, grade_calculation_fk, has_final_recovery, semi_recover_media', 'numerical', 'integerOnly'=>true),
array('approvation_media, final_recover_media', 'numerical'),
array('rule_type', 'length', 'max'=>1),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
- array('id, edcenso_stage_vs_modality_fk, approvation_media, final_recover_media, grade_calculation_fk, has_final_recovery, rule_type', 'safe', 'on'=>'search'),
+ array('id, edcenso_stage_vs_modality_fk, approvation_media, final_recover_media, grade_calculation_fk, has_final_recovery, rule_type, semi_recover_media', 'safe', 'on'=>'search'),
);
}
@@ -71,6 +71,7 @@ public function attributeLabels()
'grade_calculation_fk' => 'Grade Calculation Fk',
'has_final_recovery' => 'Has Final Recovery',
'rule_type' => 'Rule Type',
+ 'semi_recover_media' => 'Semi Recover Media',
);
}
@@ -99,6 +100,7 @@ public function search()
$criteria->compare('grade_calculation_fk',$this->grade_calculation_fk);
$criteria->compare('has_final_recovery',$this->has_final_recovery);
$criteria->compare('rule_type',$this->rule_type,true);
+ $criteria->compare('semi_recover_media',$this->semi_recover_media);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
From 1800204588ca282ada08ff497798a92bd57b9209 Mon Sep 17 00:00:00 2001
From: Evellyn Jade <97754536+evellynreis@users.noreply.github.com>
Date: Thu, 29 Feb 2024 09:39:30 -0300
Subject: [PATCH 13/19] feat/migration and update case grade rules,
modification grades structure
---
.../admin/usecases/UpdateGradeRulesUsecase.php | 3 ++-
.../default.sql | 13 +++++++++++++
app/models/GradeRules.php | 7 +++++--
js/admin/grades-structure.js | 4 ++--
js/enrollment/gradesRelease/_initialization.js | 10 ++++++++++
themes/default/views/admin/gradesStructure.php | 2 +-
6 files changed, 33 insertions(+), 6 deletions(-)
create mode 100644 app/migrations/2024-02-28_grade_rules_type_semianual/default.sql
diff --git a/app/domain/admin/usecases/UpdateGradeRulesUsecase.php b/app/domain/admin/usecases/UpdateGradeRulesUsecase.php
index 1350cae13..2d62499a8 100644
--- a/app/domain/admin/usecases/UpdateGradeRulesUsecase.php
+++ b/app/domain/admin/usecases/UpdateGradeRulesUsecase.php
@@ -16,7 +16,7 @@
*/
class UpdateGradeRulesUsecase
{
- public function __construct($stage, $approvalMedia, $finalRecoverMedia, $semiRecoverMedia, $calcFinalMedia, $hasFinalRecovery,$hasSemianualRecovery, $ruleType)
+ public function __construct($stage, $approvalMedia, $finalRecoverMedia, $semiRecoverMedia, $calcFinalMedia, $hasFinalRecovery, $hasSemianualRecovery, $ruleType)
{
$this->stage = $stage;
$this->approvalMedia = $approvalMedia;
@@ -45,6 +45,7 @@ public function exec()
$gradeRules->has_final_recovery = (int) $this->hasFinalRecovery;
$gradeRules->rule_type = $this->ruleType;
$gradeRules->semi_recover_media = $this->semiRecoverMedia;
+ $gradeRules->has_semianual_recovery = (int) $this->hasSemianualRecovery;
if(!$gradeRules->validate()){
Yii::log(TagUtils::stringfyValidationErrors($gradeRules), CLogger::LEVEL_ERROR);
diff --git a/app/migrations/2024-02-28_grade_rules_type_semianual/default.sql b/app/migrations/2024-02-28_grade_rules_type_semianual/default.sql
new file mode 100644
index 000000000..4e420998c
--- /dev/null
+++ b/app/migrations/2024-02-28_grade_rules_type_semianual/default.sql
@@ -0,0 +1,13 @@
+create table `grade_unity_semianual` (
+`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
+`grade_unity_fk` int,
+`grade_unity_semianual_fk` int
+);
+
+ALTER TABLE grade_unity_semianual ADD CONSTRAINT grade_unity_semianual_FK FOREIGN KEY (id) REFERENCES grade_unity(id);
+ALTER TABLE grade_unity_semianual ADD CONSTRAINT grade_unity_fk FOREIGN KEY (id) REFERENCES grade_unity(id);
+
+ALTER TABLE `grade_rules`
+ADD `semi_recover_media` int NOT NULL;
+
+ALTER TABLE `grade_rules` ADD has_semianual_recovery tinyint(1) DEFAULT 0 NOT NULL;
diff --git a/app/models/GradeRules.php b/app/models/GradeRules.php
index 5a85612ce..bf9e70743 100644
--- a/app/models/GradeRules.php
+++ b/app/models/GradeRules.php
@@ -12,6 +12,7 @@
* @property integer $has_final_recovery
* @property string $rule_type
* @property integer $semi_recover_media
+ * @property integer $has_semianual_recovery
*
* The followings are the available model relations:
* @property GradeCalculation $gradeCalculationFk
@@ -36,12 +37,12 @@ public function rules()
// will receive user inputs.
return array(
array('edcenso_stage_vs_modality_fk, approvation_media, final_recover_media, semi_recover_media', 'required'),
- array('edcenso_stage_vs_modality_fk, grade_calculation_fk, has_final_recovery, semi_recover_media', 'numerical', 'integerOnly'=>true),
+ array('edcenso_stage_vs_modality_fk, grade_calculation_fk, has_final_recovery, semi_recover_media, has_semianual_recovery', 'numerical', 'integerOnly'=>true),
array('approvation_media, final_recover_media', 'numerical'),
array('rule_type', 'length', 'max'=>1),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
- array('id, edcenso_stage_vs_modality_fk, approvation_media, final_recover_media, grade_calculation_fk, has_final_recovery, rule_type, semi_recover_media', 'safe', 'on'=>'search'),
+ array('id, edcenso_stage_vs_modality_fk, approvation_media, final_recover_media, grade_calculation_fk, has_final_recovery, rule_type, semi_recover_media, has_semianual_recovery', 'safe', 'on'=>'search'),
);
}
@@ -72,6 +73,7 @@ public function attributeLabels()
'has_final_recovery' => 'Has Final Recovery',
'rule_type' => 'Rule Type',
'semi_recover_media' => 'Semi Recover Media',
+ 'has_semianual_recovery' => 'Has Semianual Recovery',
);
}
@@ -101,6 +103,7 @@ public function search()
$criteria->compare('has_final_recovery',$this->has_final_recovery);
$criteria->compare('rule_type',$this->rule_type,true);
$criteria->compare('semi_recover_media',$this->semi_recover_media);
+ $criteria->compare('has_semianual_recovery',$this->has_semianual_recovery);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
diff --git a/js/admin/grades-structure.js b/js/admin/grades-structure.js
index 07e286c72..7891ae8f1 100644
--- a/js/admin/grades-structure.js
+++ b/js/admin/grades-structure.js
@@ -342,7 +342,7 @@ function saveUnities(reply) {
unities: unities,
approvalMedia: $(".approval-media").val(),
hasFinalRecovery: $("#has_final_recovery").is(":checked"),
- hasRecoverySemianual: $("#has_recovery_semianual").is(":checked"),
+ hasRecoverySemianual: $("#has_semianual_recovery").is(":checked"),
finalRecovery: {
id: $(".final-recovery-unity-id").val(),
name: $(".final-recovery-unity-name").val(),
@@ -587,7 +587,7 @@ function loadStructure() {
$(".js-grades-structure-container").children(".unity").remove();
$(".approval-media").val(data.approvalMedia);
$("#has_final_recovery").prop("checked", data.hasFinalRecovery);
- $("#has_recovery_semianual").prop("checked", data.hasRecoverySemianual);
+ $("#has_semianual_recovery").prop("checked", data.hasRecoverySemianual);
$(".calculation-final-media").select2(
"val",
data.mediaCalculation
diff --git a/js/enrollment/gradesRelease/_initialization.js b/js/enrollment/gradesRelease/_initialization.js
index 35a43ad96..6dca914ec 100644
--- a/js/enrollment/gradesRelease/_initialization.js
+++ b/js/enrollment/gradesRelease/_initialization.js
@@ -93,6 +93,9 @@ $('#discipline').change(function (e, triggerEvent) {
if(data.rule == "N") {
html += `
+
1º Recuperação Semestral
+ 2º Recuperação Semestral
+ Média Semestral
Recuperação Final
Média Final
`;
@@ -164,6 +167,13 @@ $('#discipline').change(function (e, triggerEvent) {
if(data.rule == "N") {
html += `
+
+
+
+
+
+
+ ${this.finalMedia }
diff --git a/themes/default/views/admin/gradesStructure.php b/themes/default/views/admin/gradesStructure.php
index a336d4c2b..e0246a9ae 100644
--- a/themes/default/views/admin/gradesStructure.php
+++ b/themes/default/views/admin/gradesStructure.php
@@ -94,7 +94,7 @@
't-field-checkbox__input js-has-semianual-unity'
From f6b6253d786cc6210044244f0a85c9be7f24dfc7 Mon Sep 17 00:00:00 2001
From: Evellyn Jade <97754536+evellynreis@users.noreply.github.com>
Date: Fri, 1 Mar 2024 09:08:06 -0300
Subject: [PATCH 14/19] feat/crud screen grades releases
---
app/controllers/EnrollmentController.php | 4 +
app/controllers/GradesController.php | 7 ++
.../default.sql | 5 +
app/models/GradeResults.php | 119 +++++++++---------
.../gradesRelease/_initialization.js | 8 +-
5 files changed, 84 insertions(+), 59 deletions(-)
diff --git a/app/controllers/EnrollmentController.php b/app/controllers/EnrollmentController.php
index a22a074cb..7ae602297 100755
--- a/app/controllers/EnrollmentController.php
+++ b/app/controllers/EnrollmentController.php
@@ -560,6 +560,10 @@ public function actionSaveGradesReportCard()
$gradeResult->discipline_fk = $discipline;
$gradeResult->rec_final = $std["recFinal"];
+ $gradeResult->rec_semianual_1 = $std["recSemianual1"];
+ $gradeResult->rec_semianual_2 = $std["recSemianual2"];
+ $gradeResult->semianual_media = $std["semianualMedia"];
+
$hasAllValues = true;
foreach ($std['grades'] as $key => $value) {
$index = $key + 1;
diff --git a/app/controllers/GradesController.php b/app/controllers/GradesController.php
index d91b45f15..4439f6ab6 100644
--- a/app/controllers/GradesController.php
+++ b/app/controllers/GradesController.php
@@ -222,6 +222,8 @@ public function actionSaveGradesRelease()
$gradeResult->enrollment_fk = $std['enrollmentId'];
$gradeResult->discipline_fk = $discipline;
$gradeResult->rec_final = $std["recFinal"];
+ $gradeResult->rec_semianual_1 = $std["recSemianual1"];
+ $gradeResult->rec_semianual_2 = $std["recSemianual2"];
$gradeResult->final_concept = $std["finalConcept"];
$hasAllValues = true;
@@ -346,6 +348,11 @@ public function actionGetReportCardGrades()
$arr["finalMedia"] = $gradeResult->final_media ?? "";
$arr["recFinal"] = $gradeResult->rec_final ?? "";
+
+ $arr["recSemianual1"] = $gradeResult->rec_semianual_1 ?? "";
+ $arr["recSemianual2"] = $gradeResult->rec_semianual_2 ?? "";
+ $arr["semianualMedia"] = $gradeResult->semianual_media ?? "";
+
$arr["finalConcept"] = $gradeResult->final_concept;
$arr["situation"] = $studentEnrollment->getCurrentStatus();
diff --git a/app/migrations/2024-02-28_grade_rules_type_semianual/default.sql b/app/migrations/2024-02-28_grade_rules_type_semianual/default.sql
index 4e420998c..ebd07c8f5 100644
--- a/app/migrations/2024-02-28_grade_rules_type_semianual/default.sql
+++ b/app/migrations/2024-02-28_grade_rules_type_semianual/default.sql
@@ -11,3 +11,8 @@ ALTER TABLE `grade_rules`
ADD `semi_recover_media` int NOT NULL;
ALTER TABLE `grade_rules` ADD has_semianual_recovery tinyint(1) DEFAULT 0 NOT NULL;
+
+ALTER TABLE `grade_results`
+ADD rec_semianual_1 FLOAT NULL AFTER `rec_final`,
+ADD rec_semianual_2 FLOAT NULL AFTER `rec_final`,
+ADD semianual_media FLOAT NULL AFTER `rec_final`;
diff --git a/app/models/GradeResults.php b/app/models/GradeResults.php
index 3eaef46da..78c9d5af4 100644
--- a/app/models/GradeResults.php
+++ b/app/models/GradeResults.php
@@ -26,6 +26,9 @@
* @property double $rec_sem_3
* @property double $rec_sem_4
* @property double $rec_final
+ * @property double $semianual_media
+ * @property double $rec_semianual_2
+ * @property double $rec_semianual_1
* @property double $final_media
* @property string $grade_concept_1
* @property string $grade_concept_2
@@ -35,25 +38,26 @@
* @property string $grade_concept_6
* @property string $grade_concept_7
* @property string $grade_concept_8
- * @property double $grade_faults_1
- * @property double $grade_faults_2
- * @property double $grade_faults_3
- * @property double $grade_faults_4
- * @property double $grade_faults_5
- * @property double $grade_faults_6
- * @property double $grade_faults_7
- * @property double $grade_faults_8
- * @property double $given_classes_1
- * @property double $given_classes_2
- * @property double $given_classes_3
- * @property double $given_classes_4
- * @property double $given_classes_5
- * @property double $given_classes_6
- * @property double $given_classes_7
- * @property double $given_classes_8
* @property string $situation
* @property integer $enrollment_fk
* @property integer $discipline_fk
+ * @property integer $grade_faults_1
+ * @property integer $grade_faults_2
+ * @property integer $grade_faults_3
+ * @property integer $grade_faults_4
+ * @property integer $grade_faults_5
+ * @property integer $grade_faults_6
+ * @property integer $grade_faults_7
+ * @property integer $grade_faults_8
+ * @property integer $given_classes_1
+ * @property integer $given_classes_2
+ * @property integer $given_classes_3
+ * @property integer $given_classes_4
+ * @property integer $given_classes_5
+ * @property integer $given_classes_6
+ * @property integer $given_classes_7
+ * @property integer $given_classes_8
+ * @property integer $final_concept
*
* The followings are the available model relations:
* @property StudentEnrollment $enrollmentFk
@@ -78,17 +82,12 @@ public function rules()
// will receive user inputs.
return array(
array('enrollment_fk, discipline_fk', 'required'),
- array('enrollment_fk, discipline_fk', 'numerical', 'integerOnly'=>true),
- array('grade_1, grade_2, grade_3, grade_4, grade_5, grade_6, grade_7, grade_8, grade_faults_1, grade_faults_2, grade_faults_3, grade_faults_4, grade_faults_5, grade_faults_6,
- grade_faults_7, grade_faults_8, given_classes_1, given_classes_2, given_classes_3, given_classes_4, given_classes_5, given_classes_6, given_classes_7, given_classes_8, rec_bim_1,
- rec_bim_2, rec_bim_3, rec_bim_4, rec_bim_5, rec_bim_6, rec_bim_7, rec_bim_8, rec_sem_1, rec_sem_2, rec_sem_3, rec_sem_4, rec_final, final_media', 'numerical'),
+ array('enrollment_fk, discipline_fk, grade_faults_1, grade_faults_2, grade_faults_3, grade_faults_4, grade_faults_5, grade_faults_6, grade_faults_7, grade_faults_8, given_classes_1, given_classes_2, given_classes_3, given_classes_4, given_classes_5, given_classes_6, given_classes_7, given_classes_8, final_concept', 'numerical', 'integerOnly'=>true),
+ array('grade_1, grade_2, grade_3, grade_4, grade_5, grade_6, grade_7, grade_8, rec_bim_1, rec_bim_2, rec_bim_3, rec_bim_4, rec_bim_5, rec_bim_6, rec_bim_7, rec_bim_8, rec_sem_1, rec_sem_2, rec_sem_3, rec_sem_4, rec_final, semianual_media, rec_semianual_2, rec_semianual_1, final_media', 'numerical'),
array('grade_concept_1, grade_concept_2, grade_concept_3, grade_concept_4, grade_concept_5, grade_concept_6, grade_concept_7, grade_concept_8, situation', 'length', 'max'=>50),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
- array('id, grade_1, grade_2, grade_3, grade_4, grade_5, grade_6, grade_7, grade_8, grade_faults_1, grade_faults_2, grade_faults_3, grade_faults_4, grade_faults_5, grade_faults_6,
- grade_faults_7, grade_faults_8, rec_bim_1, rec_bim_2, rec_bim_3, rec_bim_4, rec_bim_5, rec_bim_6, rec_bim_7, rec_bim_8, rec_sem_1, rec_sem_2, rec_sem_3, rec_sem_4, rec_final,
- final_media, grade_concept_1, grade_concept_2, grade_concept_3, grade_concept_4, grade_concept_5, grade_concept_6, grade_concept_7, grade_concept_8, situation, enrollment_fk,
- discipline_fk', 'safe', 'on'=>'search'),
+ array('id, grade_1, grade_2, grade_3, grade_4, grade_5, grade_6, grade_7, grade_8, rec_bim_1, rec_bim_2, rec_bim_3, rec_bim_4, rec_bim_5, rec_bim_6, rec_bim_7, rec_bim_8, rec_sem_1, rec_sem_2, rec_sem_3, rec_sem_4, rec_final, semianual_media, rec_semianual_2, rec_semianual_1, final_media, grade_concept_1, grade_concept_2, grade_concept_3, grade_concept_4, grade_concept_5, grade_concept_6, grade_concept_7, grade_concept_8, situation, enrollment_fk, discipline_fk, grade_faults_1, grade_faults_2, grade_faults_3, grade_faults_4, grade_faults_5, grade_faults_6, grade_faults_7, grade_faults_8, given_classes_1, given_classes_2, given_classes_3, given_classes_4, given_classes_5, given_classes_6, given_classes_7, given_classes_8, final_concept', 'safe', 'on'=>'search'),
);
}
@@ -120,22 +119,6 @@ public function attributeLabels()
'grade_6' => 'Grade 6',
'grade_7' => 'Grade 7',
'grade_8' => 'Grade 8',
- 'grade_faults_1' => 'Grade Faults 1',
- 'grade_faults_2' => 'Grade Faults 2',
- 'grade_faults_3' => 'Grade Faults 3',
- 'grade_faults_4' => 'Grade Faults 4',
- 'grade_faults_5' => 'Grade Faults 5',
- 'grade_faults_6' => 'Grade Faults 6',
- 'grade_faults_7' => 'Grade Faults 7',
- 'grade_faults_8' => 'Grade Faults 8',
- 'given_classes_1' => 'Given Classes 1',
- 'given_classes_2' => 'Given Classes 2',
- 'given_classes_3' => 'Given Classes 3',
- 'given_classes_4' => 'Given Classes 4',
- 'given_classes_5' => 'Given Classes 5',
- 'given_classes_6' => 'Given Classes 6',
- 'given_classes_7' => 'Given Classes 7',
- 'given_classes_8' => 'Given Classes 8',
'rec_bim_1' => 'Rec Bim 1',
'rec_bim_2' => 'Rec Bim 2',
'rec_bim_3' => 'Rec Bim 3',
@@ -149,6 +132,9 @@ public function attributeLabels()
'rec_sem_3' => 'Rec Sem 3',
'rec_sem_4' => 'Rec Sem 4',
'rec_final' => 'Rec Final',
+ 'semianual_media' => 'Semianual Media',
+ 'rec_semianual_2' => 'Rec Semianual 2',
+ 'rec_semianual_1' => 'Rec Semianual 1',
'final_media' => 'Final Media',
'grade_concept_1' => 'Grade Concept 1',
'grade_concept_2' => 'Grade Concept 2',
@@ -161,6 +147,23 @@ public function attributeLabels()
'situation' => 'Situation',
'enrollment_fk' => 'Enrollment Fk',
'discipline_fk' => 'Discipline Fk',
+ 'grade_faults_1' => 'Grade Faults 1',
+ 'grade_faults_2' => 'Grade Faults 2',
+ 'grade_faults_3' => 'Grade Faults 3',
+ 'grade_faults_4' => 'Grade Faults 4',
+ 'grade_faults_5' => 'Grade Faults 5',
+ 'grade_faults_6' => 'Grade Faults 6',
+ 'grade_faults_7' => 'Grade Faults 7',
+ 'grade_faults_8' => 'Grade Faults 8',
+ 'given_classes_1' => 'Given Classes 1',
+ 'given_classes_2' => 'Given Classes 2',
+ 'given_classes_3' => 'Given Classes 3',
+ 'given_classes_4' => 'Given Classes 4',
+ 'given_classes_5' => 'Given Classes 5',
+ 'given_classes_6' => 'Given Classes 6',
+ 'given_classes_7' => 'Given Classes 7',
+ 'given_classes_8' => 'Given Classes 8',
+ 'final_concept' => 'Final Concept',
);
}
@@ -191,22 +194,6 @@ public function search()
$criteria->compare('grade_6',$this->grade_6);
$criteria->compare('grade_7',$this->grade_7);
$criteria->compare('grade_8',$this->grade_8);
- $criteria->compare('grade_faults_1',$this->grade_faults_1);
- $criteria->compare('grade_faults_2',$this->grade_faults_2);
- $criteria->compare('grade_faults_3',$this->grade_faults_3);
- $criteria->compare('grade_faults_4',$this->grade_faults_4);
- $criteria->compare('grade_faults_5',$this->grade_faults_5);
- $criteria->compare('grade_faults_6',$this->grade_faults_6);
- $criteria->compare('grade_faults_7',$this->grade_faults_7);
- $criteria->compare('grade_faults_8',$this->grade_faults_8);
- $criteria->compare('given_classes_1',$this->given_classes_1);
- $criteria->compare('given_classes_2',$this->given_classes_2);
- $criteria->compare('given_classes_3',$this->given_classes_3);
- $criteria->compare('given_classes_4',$this->given_classes_4);
- $criteria->compare('given_classes_5',$this->given_classes_5);
- $criteria->compare('given_classes_6',$this->given_classes_6);
- $criteria->compare('given_classes_7',$this->given_classes_7);
- $criteria->compare('given_classes_8',$this->given_classes_8);
$criteria->compare('rec_bim_1',$this->rec_bim_1);
$criteria->compare('rec_bim_2',$this->rec_bim_2);
$criteria->compare('rec_bim_3',$this->rec_bim_3);
@@ -220,6 +207,9 @@ public function search()
$criteria->compare('rec_sem_3',$this->rec_sem_3);
$criteria->compare('rec_sem_4',$this->rec_sem_4);
$criteria->compare('rec_final',$this->rec_final);
+ $criteria->compare('semianual_media',$this->semianual_media);
+ $criteria->compare('rec_semianual_2',$this->rec_semianual_2);
+ $criteria->compare('rec_semianual_1',$this->rec_semianual_1);
$criteria->compare('final_media',$this->final_media);
$criteria->compare('grade_concept_1',$this->grade_concept_1,true);
$criteria->compare('grade_concept_2',$this->grade_concept_2,true);
@@ -232,6 +222,23 @@ public function search()
$criteria->compare('situation',$this->situation,true);
$criteria->compare('enrollment_fk',$this->enrollment_fk);
$criteria->compare('discipline_fk',$this->discipline_fk);
+ $criteria->compare('grade_faults_1',$this->grade_faults_1);
+ $criteria->compare('grade_faults_2',$this->grade_faults_2);
+ $criteria->compare('grade_faults_3',$this->grade_faults_3);
+ $criteria->compare('grade_faults_4',$this->grade_faults_4);
+ $criteria->compare('grade_faults_5',$this->grade_faults_5);
+ $criteria->compare('grade_faults_6',$this->grade_faults_6);
+ $criteria->compare('grade_faults_7',$this->grade_faults_7);
+ $criteria->compare('grade_faults_8',$this->grade_faults_8);
+ $criteria->compare('given_classes_1',$this->given_classes_1);
+ $criteria->compare('given_classes_2',$this->given_classes_2);
+ $criteria->compare('given_classes_3',$this->given_classes_3);
+ $criteria->compare('given_classes_4',$this->given_classes_4);
+ $criteria->compare('given_classes_5',$this->given_classes_5);
+ $criteria->compare('given_classes_6',$this->given_classes_6);
+ $criteria->compare('given_classes_7',$this->given_classes_7);
+ $criteria->compare('given_classes_8',$this->given_classes_8);
+ $criteria->compare('final_concept',$this->final_concept);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
diff --git a/js/enrollment/gradesRelease/_initialization.js b/js/enrollment/gradesRelease/_initialization.js
index 6dca914ec..4d9c003d5 100644
--- a/js/enrollment/gradesRelease/_initialization.js
+++ b/js/enrollment/gradesRelease/_initialization.js
@@ -168,12 +168,12 @@ $('#discipline').change(function (e, triggerEvent) {
if(data.rule == "N") {
html += `
-
+
-
+
-
${this.finalMedia }
+
${this.semianualMedia}
@@ -237,6 +237,8 @@ $("#save").on("click", function (e) {
enrollmentId: $(this).find(".enrollment-id").val(),
grades: grades,
recFinal: $(this).find(".rec-final").val(),
+ recSemianual1: $(this).find(".one-semianual").val(),
+ recSemianual2: $(this).find(".two-semianual").val(),
finalConcept: $(this).find(".final-concept").val()
});
});
From a74b249f446d28319c517d3c0265096652fb18ed Mon Sep 17 00:00:00 2001
From: Evellyn Jade <97754536+evellynreis@users.noreply.github.com>
Date: Mon, 4 Mar 2024 10:34:27 -0300
Subject: [PATCH 15/19] feat/add class calculate semi media use case
---
app/controllers/EnrollmentController.php | 7 ++
app/controllers/GradesController.php | 8 ++
.../CalculateSemianualMediaUsecase.php | 88 +++++++++++++++++++
3 files changed, 103 insertions(+)
create mode 100644 app/domain/grades/usecases/CalculateSemianualMediaUsecase.php
diff --git a/app/controllers/EnrollmentController.php b/app/controllers/EnrollmentController.php
index 7ae602297..2d422d09a 100755
--- a/app/controllers/EnrollmentController.php
+++ b/app/controllers/EnrollmentController.php
@@ -591,6 +591,13 @@ public function actionSaveGradesReportCard()
);
$usecaseFinalMedia->exec();
+ $usecaseSemiMedia = new CalculateSemianualMediaUsecase(
+ $gradeResult,
+ $gradeRules,
+ count($std['grades'])
+ );
+ $usecaseSemiMedia->exec();
+
if ($gradeResult->enrollmentFk->isActive()) {
$usecase = new ChageStudentStatusByGradeUsecase(
$gradeResult,
diff --git a/app/controllers/GradesController.php b/app/controllers/GradesController.php
index 4439f6ab6..f18fed0a0 100644
--- a/app/controllers/GradesController.php
+++ b/app/controllers/GradesController.php
@@ -258,6 +258,14 @@ public function actionSaveGradesRelease()
);
$usecaseFinalMedia->exec();
+ $count = 2;
+ $usecaseSemiMedia = new CalculateSemianualMediaUsecase(
+ $gradeResult,
+ $gradeRules,
+ $count
+ );
+ $usecaseSemiMedia->exec();
+
if ($gradeResult->enrollmentFk->isActive()) {
$usecase = new ChageStudentStatusByGradeUsecase(
$gradeResult,
diff --git a/app/domain/grades/usecases/CalculateSemianualMediaUsecase.php b/app/domain/grades/usecases/CalculateSemianualMediaUsecase.php
new file mode 100644
index 000000000..cde3eb691
--- /dev/null
+++ b/app/domain/grades/usecases/CalculateSemianualMediaUsecase.php
@@ -0,0 +1,88 @@
+gradesResult = $gradesResult;
+ $this->gradeRule = $gradeRule;
+ $this->countUnities = $countUnities;
+ }
+
+ public function exec()
+ {
+ $semiGrade =
+
+ $grades = $this->extractGrades($this->gradesResult, $this->countUnities);
+ $semianualMedia = $this->applyCalculation($this->gradeRule->gradeCalculationFk, $grades);
+
+ if ($this->shouldApplySemianualRecovery($this->gradesResult, $semianualMedia)) {
+ $this->applySemianualRecovery($this->gradesResult, $semianualMedia);
+ }
+
+ $this->saveSemianualMedia($this->gradesResult, $semianualMedia);
+ }
+
+ private function saveSemianualMedia($gradesResult, $semianualMedia)
+ {
+ $gradesResult->setAttribute("semianual_media", $semianualMedia);
+ $gradesResult->save();
+ }
+
+ private function shouldApplySemianualRecovery($gradeRule, $semianualMedia)
+ {
+ return isset($gradeRule->has_semianual_recovery)
+ && $gradeRule->has_semianual_recovery
+ && $semianualMedia < (double) $gradeRule->semi_recover_media;
+
+ }
+
+ private function applySemianualRecovery($gradesResult, $semianualMedia)
+ {
+ $semianualRecovery = $this->getSemianualRecovery($gradesResult->enrollment_fk, $gradesResult->discipline_fk);
+ return $this->applyCalculation($semianualRecovery->gradeCalculationFk, [$semianualMedia, $gradesResult->semianual_media]);
+ }
+
+ private function getSemianualRecovery($enrollmentId, $discipline)
+ {
+ $criteria = new CDbCriteria();
+ $criteria->alias = "gu";
+ $criteria->select = "distinct gu.id, gu.*";
+ $criteria->join = "join grade_unity_modality gum on gum.grade_unity_fk = gu.id";
+ $criteria->join .= " join grade g on g.grade_unity_modality_fk = gum.id";
+ $criteria->condition = "g.discipline_fk = :discipline_fk and enrollment_fk = :enrollment_fk and gu.type = :type";
+ $criteria->params = array(":discipline_fk" => $discipline, ":enrollment_fk" => $enrollmentId, ":type" => GradeUnity::TYPE_SEMIANUAL_RECOVERY);
+ $criteria->order = "gu.id";
+ return GradeUnity::model()->find($criteria);
+ }
+
+ private function applyCalculation($calculation, $grades)
+ {
+ return (new ApplyFormulaOnGradesUsecase($calculation))
+ ->setGrades($grades)
+ ->exec();
+ }
+
+ private function extractGrades($gradesResult, $countUnities)
+ {
+ $grades = [];
+ for ($i = 0; $i < $countUnities; $i++) {
+ array_push($grades, $gradesResult->attributes["grade_" . ($i + 1)]);
+ }
+ return $grades;
+ }
+
+ private function getUnitiesCount()
+ {
+ return (
+ new GetGradeUnitiesByDisciplineUsecase(
+ $this->gradeRule->edcenso_stage_vs_modality_fk
+ )
+ )->execCount();
+ }
+}
From 68851449214b5fbcbd9cdebc2c6717401adaeabe Mon Sep 17 00:00:00 2001
From: Evellyn Jade <97754536+evellynreis@users.noreply.github.com>
Date: Tue, 5 Mar 2024 08:49:50 -0300
Subject: [PATCH 16/19] =?UTF-8?q?feat/altera=C3=A7=C3=B5es=20igor?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/GradesController.php | 1 +
.../usecases/CalculateNumericGradeUsecase.php | 4 ++++
.../CalculateSemianualMediaUsecase.php | 18 ++++++++++++++++--
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/app/controllers/GradesController.php b/app/controllers/GradesController.php
index f18fed0a0..6e88b588c 100644
--- a/app/controllers/GradesController.php
+++ b/app/controllers/GradesController.php
@@ -260,6 +260,7 @@ public function actionSaveGradesRelease()
$count = 2;
$usecaseSemiMedia = new CalculateSemianualMediaUsecase(
+ $classroom->id,
$gradeResult,
$gradeRules,
$count
diff --git a/app/domain/grades/usecases/CalculateNumericGradeUsecase.php b/app/domain/grades/usecases/CalculateNumericGradeUsecase.php
index a0144e1ac..80e694dd7 100644
--- a/app/domain/grades/usecases/CalculateNumericGradeUsecase.php
+++ b/app/domain/grades/usecases/CalculateNumericGradeUsecase.php
@@ -31,6 +31,10 @@ private function calculateNumericGrades($studentEnrollment, $discipline, $unitie
$gradeResult = $this->calculateCommonUnity($gradeResult, $studentEnrollment, $discipline, $gradeUnity, $index);
} elseif ($gradeUnity->type == GradeUnity::TYPE_UNITY_WITH_RECOVERY) {
$gradeResult = $this->calculateUnityWithRecovery($gradeResult, $studentEnrollment, $discipline, $gradeUnity, $index);
+ } elseif ($gradeUnity->type == GradeUnity::TYPE_SEMIANUAL_RECOVERY) {
+ // @TODO: ALTERAR MEDOTO PARA CALCULO DA RECUPERACAO SEMESTRAL
+ $gradeResult = $this->calculateUnityWithRecovery($gradeResult, $studentEnrollment, $discipline, $gradeUnity, $index);
+ }
} elseif ($gradeUnity->type == GradeUnity::TYPE_FINAL_RECOVERY) {
$gradeResult = $this->calculateFinalRecovery($gradeResult, $studentEnrollment, $discipline, $gradeUnity);
}
diff --git a/app/domain/grades/usecases/CalculateSemianualMediaUsecase.php b/app/domain/grades/usecases/CalculateSemianualMediaUsecase.php
index cde3eb691..f41bcf6a8 100644
--- a/app/domain/grades/usecases/CalculateSemianualMediaUsecase.php
+++ b/app/domain/grades/usecases/CalculateSemianualMediaUsecase.php
@@ -4,11 +4,13 @@
* @property GradeResults $gradesResult
* @property GradeRules $gradeRule
* @property int $countUnities
+ * @property int $classroomId
*/
class CalculateSemianualMediaUsecase
{
- public function __construct($gradesResult, $gradeRule, $countUnities)
+ public function __construct($classroomId, $gradesResult, $gradeRule, $countUnities)
{
+ $this->classroomId = $classroomId;
$this->gradesResult = $gradesResult;
$this->gradeRule = $gradeRule;
$this->countUnities = $countUnities;
@@ -16,13 +18,15 @@ public function __construct($gradesResult, $gradeRule, $countUnities)
public function exec()
{
- $semiGrade =
+ //Retorna a média semianual
+ $teste = $this->getSemianualMedia($this->classroomId);
$grades = $this->extractGrades($this->gradesResult, $this->countUnities);
$semianualMedia = $this->applyCalculation($this->gradeRule->gradeCalculationFk, $grades);
if ($this->shouldApplySemianualRecovery($this->gradesResult, $semianualMedia)) {
$this->applySemianualRecovery($this->gradesResult, $semianualMedia);
+ // $this->applySemianualRecovery($this->gradesResult, $teste);
}
$this->saveSemianualMedia($this->gradesResult, $semianualMedia);
@@ -85,4 +89,14 @@ private function getUnitiesCount()
)
)->execCount();
}
+
+ private function getSemianualMedia($classroomId)
+ {
+ $classroom = Classroom::model()->findByPk($classroomId);
+ $gradeRules = GradeRules::model()->findByAttributes([
+ "edcenso_stage_vs_modality_fk" => $classroom->edcenso_stage_vs_modality_fk
+ ]);
+
+ return $gradeRules->semi_recover_media;
+ }
}
From ddfa11132946b93f560f2c5e6cd755362b10d0a9 Mon Sep 17 00:00:00 2001
From: Evellyn Jade <97754536+evellynreis@users.noreply.github.com>
Date: Wed, 6 Mar 2024 11:29:37 -0300
Subject: [PATCH 17/19] feat/function calculateSemiRecovery
---
.../grades/usecases/CalculateNumericGradeUsecase.php | 11 ++++++++++-
js/grades/functions.js | 5 ++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/app/domain/grades/usecases/CalculateNumericGradeUsecase.php b/app/domain/grades/usecases/CalculateNumericGradeUsecase.php
index 80e694dd7..40d35ffe1 100644
--- a/app/domain/grades/usecases/CalculateNumericGradeUsecase.php
+++ b/app/domain/grades/usecases/CalculateNumericGradeUsecase.php
@@ -33,7 +33,7 @@ private function calculateNumericGrades($studentEnrollment, $discipline, $unitie
$gradeResult = $this->calculateUnityWithRecovery($gradeResult, $studentEnrollment, $discipline, $gradeUnity, $index);
} elseif ($gradeUnity->type == GradeUnity::TYPE_SEMIANUAL_RECOVERY) {
// @TODO: ALTERAR MEDOTO PARA CALCULO DA RECUPERACAO SEMESTRAL
- $gradeResult = $this->calculateUnityWithRecovery($gradeResult, $studentEnrollment, $discipline, $gradeUnity, $index);
+ $gradeResult = $this->calculateSemiRecovery($gradeResult, $studentEnrollment, $discipline, $gradeUnity, $index);
}
} elseif ($gradeUnity->type == GradeUnity::TYPE_FINAL_RECOVERY) {
$gradeResult = $this->calculateFinalRecovery($gradeResult, $studentEnrollment, $discipline, $gradeUnity);
@@ -54,6 +54,15 @@ private function calculateFinalRecovery($gradeResult, $studentEnrollment, $disci
return $gradeResult;
}
+ private function calculateSemiRecovery($gradeResult, $studentEnrollment, $discipline, $unity)
+ {
+ $unityMedia = $this->calculateUnityMedia($studentEnrollment, $discipline, $unity);
+ $gradeResult->setAttribute("rec_semianual_1", is_nan($unityMedia) ? "" : $unityMedia);
+ $gradeResult->setAttribute("rec_semianual_2", is_nan($unityMedia) ? "" : $unityMedia);
+
+ return $gradeResult;
+ }
+
private function calculateCommonUnity($gradeResult, $studentEnrollment, $discipline, $unity, $index)
{
$unityMedia = $this->calculateUnityMedia($studentEnrollment, $discipline, $unity);
diff --git a/js/grades/functions.js b/js/grades/functions.js
index 32b83735c..05e7ca1f8 100644
--- a/js/grades/functions.js
+++ b/js/grades/functions.js
@@ -285,7 +285,10 @@ function GradeTableBuilder(data) {
.join("\n")}
${
!data.isUnityConcept
- ? `
Média Anual `
+ ? `
+
Média Semestral
+
Média Anual
+ `
: ""
}
Resultado
From 214501c7e824999731397499d42d77a349ac366a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Igor=20Gon=C3=A7alves?=
Date: Thu, 28 Mar 2024 15:35:28 -0300
Subject: [PATCH 18/19] feat components
---
.../foods/views/foodinventory/_form.php | 170 --------
app/modules/foods/views/foodmenu/create.php | 19 -
app/modules/foods/views/foodmenu/index.php | 98 -----
app/modules/foods/views/foodmenu/update.php | 25 --
app/modules/foods/views/foodrequest/_form.php | 111 -----
app/modules/foods/views/foodrequest/_view.php | 29 --
.../foods/views/foodrequest/create.php | 18 -
app/modules/foods/views/foodrequest/index.php | 20 -
app/modules/foods/views/foodrequest/view.php | 30 --
js/admin/grades-structure.js | 409 ++++++++++++++----
.../default/views/admin/gradesStructure.php | 10 +
11 files changed, 326 insertions(+), 613 deletions(-)
delete mode 100644 app/modules/foods/views/foodinventory/_form.php
delete mode 100644 app/modules/foods/views/foodmenu/create.php
delete mode 100644 app/modules/foods/views/foodmenu/index.php
delete mode 100644 app/modules/foods/views/foodmenu/update.php
delete mode 100644 app/modules/foods/views/foodrequest/_form.php
delete mode 100644 app/modules/foods/views/foodrequest/_view.php
delete mode 100644 app/modules/foods/views/foodrequest/create.php
delete mode 100644 app/modules/foods/views/foodrequest/index.php
delete mode 100644 app/modules/foods/views/foodrequest/view.php
diff --git a/app/modules/foods/views/foodinventory/_form.php b/app/modules/foods/views/foodinventory/_form.php
deleted file mode 100644
index a368a141a..000000000
--- a/app/modules/foods/views/foodinventory/_form.php
+++ /dev/null
@@ -1,170 +0,0 @@
-baseUrl;
-$themeUrl = Yii::app()->theme->baseUrl;
-$cs = Yii::app()->getClientScript();
-$cs->registerScriptFile('app\modules\foods\resources\inventory\_initialization.js', CClientScript::POS_END);
-$cs->registerScriptFile('app\modules\foods\resources\inventory\functions.js', CClientScript::POS_END);
-
-$form=$this->beginWidget('CActiveForm', array(
- 'id'=>'food-inventory-form',
- 'enableAjaxValidation'=>false,
-));
-
-?>
-
-
diff --git a/app/modules/foods/views/foodmenu/create.php b/app/modules/foods/views/foodmenu/create.php
deleted file mode 100644
index 4529f01ff..000000000
--- a/app/modules/foods/views/foodmenu/create.php
+++ /dev/null
@@ -1,19 +0,0 @@
-breadcrumbs=array(
- 'Food Menus'=>array('index'),
- 'Create',
-);
-$this->setPageTitle('TAG - ' . Yii::t('default', 'Criar Cardápio'));
-$this->menu=array(
- array('label'=>'List FoodMenu', 'url'=>array('index')),
- array('label'=>'Manage FoodMenu', 'url'=>array('admin')),
-);
-$title = "Criar Cardápio";
-?>
-
-
-
-renderPartial('_form', array('model'=>$model,'stages'=>$stages, 'title' => $title)); ?>
diff --git a/app/modules/foods/views/foodmenu/index.php b/app/modules/foods/views/foodmenu/index.php
deleted file mode 100644
index 440dcd23d..000000000
--- a/app/modules/foods/views/foodmenu/index.php
+++ /dev/null
@@ -1,98 +0,0 @@
-breadcrumbs = array(
- 'Food Menus' => array('index'),
- 'Manage',
-);
-
-$this->menu = array(
- array('label' => 'List FoodMenu', 'url' => array('index')),
- array('label' => 'Create FoodMenu', 'url' => array('create')),
-);
-
-?>
-
-
-
-
-
-
- user->hasFlash('success')): ?>
-
- user->getFlash('success') ?>
-
-
-
-
-
-
- widget(
- 'zii.widgets.grid.CGridView',
- array(
- 'id' => 'food-menu-grid',
- 'dataProvider' => $dataProvider,
- 'enablePagination' => false,
- 'enableSorting' => false,
- 'ajaxUpdate' => false,
- 'itemsCssClass' => 'js-tag-table tag-table-primary table table-condensed table-striped table-hover table-primary table-vertical-center checkboxs',
- 'columns' => array(
- 'id',
- 'description' => array(
- 'header' => 'Nome',
- 'type' => 'raw',
- 'value' => 'CHtml::link($data->description,Yii::app()->createUrl("foods/foodmenu/update",array("id"=>$data->id)))',
- 'htmlOptions' => array('width' => '400px', 'class' => 'link-update-grid-view'),
- ),
- 'start_date' => array(
- 'header' => 'Início',
- 'type' => 'raw',
- 'value' => 'DateTime::createFromFormat("Y-m-d",$data->start_date)->format("d/m/Y")',
- 'htmlOptions' => array('width' => '400px', 'class' => 'link-update-grid-view'),
- ),
- 'final_date' => array(
- 'header' => 'Fim',
- 'type' => 'raw',
- 'value' => 'DateTime::createFromFormat("Y-m-d",$data->final_date)->format("d/m/Y")',
- 'htmlOptions' => array('width' => '400px', 'class' => 'link-update-grid-view'),
- ),
- array(
- 'header' => 'Ações',
- 'class' => 'CButtonColumn',
- 'template' => '{update}{delete}',
- 'buttons' => array(
- 'update' => array(
- 'imageUrl' => Yii::app()->theme->baseUrl . '/img/editar.svg',
- ),
- 'delete' => array(
- 'imageUrl' => Yii::app()->theme->baseUrl . '/img/deletar.svg',
- )
- ),
- 'updateButtonOptions' => array('style' => 'margin-right: 20px;'),
- 'deleteButtonOptions' => array('style' => 'cursor: pointer;'),
- 'htmlOptions' => array('width' => '100px', 'style' => 'text-align: center'),
- )
- ),
- )
- ); ?>
-
-
-
-
-
diff --git a/app/modules/foods/views/foodmenu/update.php b/app/modules/foods/views/foodmenu/update.php
deleted file mode 100644
index f2d355e60..000000000
--- a/app/modules/foods/views/foodmenu/update.php
+++ /dev/null
@@ -1,25 +0,0 @@
-breadcrumbs=array(
- 'Food Menus'=>array('index'),
- $model->id=>array('view','id'=>$model->id),
- 'Update',
-);
-
-$this->menu=array(
- array('label'=>'List FoodMenu', 'url'=>array('index')),
- array('label'=>'Create FoodMenu', 'url'=>array('create')),
- array('label'=>'View FoodMenu', 'url'=>array('view', 'id'=>$model->id)),
- array('label'=>'Manage FoodMenu', 'url'=>array('admin')),
-);
-$title = $model->description
-?>
-
-
-renderPartial('_form', array('model'=>$model, 'title' => $title)); ?>
-
diff --git a/app/modules/foods/views/foodrequest/_form.php b/app/modules/foods/views/foodrequest/_form.php
deleted file mode 100644
index b3413965f..000000000
--- a/app/modules/foods/views/foodrequest/_form.php
+++ /dev/null
@@ -1,111 +0,0 @@
-baseUrl;
-$themeUrl = Yii::app()->theme->baseUrl;
-$cs = Yii::app()->getClientScript();
-$cs->registerScriptFile('app\modules\foods\resources\request\_initialization.js', CClientScript::POS_END);
-$cs->registerScriptFile('app\modules\foods\resources\request\functions.js', CClientScript::POS_END);
-
-$form=$this->beginWidget('CActiveForm', array(
- 'id'=>'food-request-form',
- 'enableAjaxValidation'=>false,
-));
-?>
-
-
diff --git a/app/modules/foods/views/foodrequest/_view.php b/app/modules/foods/views/foodrequest/_view.php
deleted file mode 100644
index ebc2773b4..000000000
--- a/app/modules/foods/views/foodrequest/_view.php
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
- getAttributeLabel('id')); ?>:
- id), array('view', 'id'=>$data->id)); ?>
-
-
- getAttributeLabel('date')); ?>:
- date); ?>
-
-
- getAttributeLabel('food_fk')); ?>:
- food_fk); ?>
-
-
- getAttributeLabel('amount')); ?>:
- amount); ?>
-
-
- getAttributeLabel('measurementUnit')); ?>:
- measurementUnit); ?>
-
-
-
-
\ No newline at end of file
diff --git a/app/modules/foods/views/foodrequest/create.php b/app/modules/foods/views/foodrequest/create.php
deleted file mode 100644
index 5662a4a79..000000000
--- a/app/modules/foods/views/foodrequest/create.php
+++ /dev/null
@@ -1,18 +0,0 @@
-breadcrumbs=array(
- 'Food Requests'=>array('index'),
- 'Create',
-);
-
-$this->menu=array(
- array('label'=>'List FoodRequest', 'url'=>array('index')),
- array('label'=>'Manage FoodRequest', 'url'=>array('admin')),
-);
-?>
-
-
- renderPartial('_form', array('model'=>$model)); ?>
-
diff --git a/app/modules/foods/views/foodrequest/index.php b/app/modules/foods/views/foodrequest/index.php
deleted file mode 100644
index 379b441e3..000000000
--- a/app/modules/foods/views/foodrequest/index.php
+++ /dev/null
@@ -1,20 +0,0 @@
-breadcrumbs=array(
- 'Food Requests',
-);
-
-$this->menu=array(
- array('label'=>'Create FoodRequest', 'url'=>array('create')),
- array('label'=>'Manage FoodRequest', 'url'=>array('admin')),
-);
-?>
-
-Food Requests
-
-widget('zii.widgets.CListView', array(
- 'dataProvider'=>$dataProvider,
- 'itemView'=>'_view',
-)); ?>
diff --git a/app/modules/foods/views/foodrequest/view.php b/app/modules/foods/views/foodrequest/view.php
deleted file mode 100644
index 3f4eaa7b4..000000000
--- a/app/modules/foods/views/foodrequest/view.php
+++ /dev/null
@@ -1,30 +0,0 @@
-breadcrumbs=array(
- 'Food Requests'=>array('index'),
- $model->id,
-);
-
-$this->menu=array(
- array('label'=>'List FoodRequest', 'url'=>array('index')),
- array('label'=>'Create FoodRequest', 'url'=>array('create')),
- array('label'=>'Update FoodRequest', 'url'=>array('update', 'id'=>$model->id)),
- array('label'=>'Delete FoodRequest', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
- array('label'=>'Manage FoodRequest', 'url'=>array('admin')),
-);
-?>
-
-View FoodRequest #id; ?>
-
-widget('zii.widgets.CDetailView', array(
- 'data'=>$model,
- 'attributes'=>array(
- 'id',
- 'date',
- 'food_fk',
- 'amount',
- 'measurementUnit',
- ),
-)); ?>
diff --git a/js/admin/grades-structure.js b/js/admin/grades-structure.js
index 7891ae8f1..a40d81593 100644
--- a/js/admin/grades-structure.js
+++ b/js/admin/grades-structure.js
@@ -23,8 +23,9 @@ $(document).on("click", ".js-new-unity", function (e) {
-
+
@@ -34,15 +35,17 @@ $(document).on("click", ".js-new-unity", function (e) {
Modelo:
- ${isUnityConcept
- ? `Unidade por conceito `
- : `Unidade
+ ${
+ isUnityConcept
+ ? `Unidade por conceito `
+ : `Unidade
Unidade com recuperação `
- }
+ }
-
+
Forma de cálculo:
${$(".formulas")[0].innerHTML}
@@ -61,7 +64,7 @@ $(document).on("click", ".js-new-unity", function (e) {
-
`;
+
`;
$(".js-grades-structure-container").append(unityHtml);
if ($(".js-rule-type").select2("val") === "C") {
@@ -169,32 +172,6 @@ $(document).on("keyup", ".weight", function (e) {
$(document).on("click", ".js-new-modality", function (e) {
e.preventDefault();
- const unityElement = $(this).closest(".unity");
- const formula = unityElement
- .find(".js-formula-select")
- .select2("data").text;
- const modalityHtml = template`
-
`;
-
- $(modalityHtml).appendTo(unityElement.find(".js-modality-container"));
});
$(document).on("click", ".js-remove-unity", function (e) {
@@ -289,22 +266,15 @@ function initRuleType(ruleType) {
$(".numeric-fields").hide();
$(".js-recovery-form").hide();
$(".final-recovery-unity-operation").val("delete");
- $("select.js-type-select").html(
- `
Unidade por conceito `
- );
$(".js-calculation").hide();
$(".remove-modality").hide();
} else if (ruleType === "N") {
$(".numeric-fields").show();
$(".js-has-final-recovery").trigger("change");
- $("select.js-type-select").html(`
Unidade
-
Unidade com recuperação `);
$(".js-calculation").show();
$(".js-new-modality").show();
$(".remove-modality").show();
}
-
- $("select.js-type-select").select2();
}
function saveUnities(reply) {
@@ -357,20 +327,20 @@ function saveUnities(reply) {
id: $(".semianual-unity-id").val(),
name: $(".one-semianual-unity-name").val(),
type: $(".semianual-unity-type").val(),
- grade_calculation_fk: $(".semianual-recovery-unity-calculation").select2(
- "val"
- ),
+ grade_calculation_fk: $(
+ ".semianual-recovery-unity-calculation"
+ ).select2("val"),
operation: $(".semianual-unity-operation").val(),
},
{
id: $(".semianual-unity-id").val(),
name: $(".two-semianual-unity-name").val(),
type: $(".semianual-unity-type").val(),
- grade_calculation_fk: $(".semianual-recovery-unity-calculation").select2(
- "val"
- ),
+ grade_calculation_fk: $(
+ ".semianual-recovery-unity-calculation"
+ ).select2("val"),
operation: $(".semianual-unity-operation").val(),
- }
+ },
],
finalRecoverMedia: $(".final-recover-media").val(),
semiRecoverMedia: $("#semianual-unity-media").val(),
@@ -453,7 +423,8 @@ function checkValidInputs() {
$(".approval-media").val() < $(".final-recover-media").val()
) {
valid = false;
- message = "A média de recuperação final não pode ser superior à de aprovação.";
+ message =
+ "A média de recuperação final não pode ser superior à de aprovação.";
}
if (valid) {
@@ -587,7 +558,10 @@ function loadStructure() {
$(".js-grades-structure-container").children(".unity").remove();
$(".approval-media").val(data.approvalMedia);
$("#has_final_recovery").prop("checked", data.hasFinalRecovery);
- $("#has_semianual_recovery").prop("checked", data.hasRecoverySemianual);
+ $("#has_semianual_recovery").prop(
+ "checked",
+ data.hasRecoverySemianual
+ );
$(".calculation-final-media").select2(
"val",
data.mediaCalculation
@@ -609,20 +583,23 @@ function loadStructure() {
// data.recovery_semianual.grade_calculation_fk
// );
- const dataUnities = data.unities.map(unity => [unity.id, unity.name]);
- const selectUnitiesFirst = $('#semianual-modality-first');
- const selectUnitiesSecond = $('#semianual-modality-second');
+ const dataUnities = data.unities.map((unity) => [
+ unity.id,
+ unity.name,
+ ]);
+ const selectUnitiesFirst = $("#semianual-modality-first");
+ const selectUnitiesSecond = $("#semianual-modality-second");
console.log(data);
dataUnities.forEach(function ([id, name]) {
- const optionFirst = $('
', {
+ const optionFirst = $(" ", {
value: id,
- text: name
+ text: name,
});
- const optionSecond = $(' ', {
+ const optionSecond = $(" ", {
value: id,
- text: name
+ text: name,
});
selectUnitiesFirst.append(optionFirst);
selectUnitiesSecond.append(optionSecond);
@@ -648,32 +625,11 @@ function loadStructure() {
).show();
if (Object.keys(data.unities).length) {
- $.each(data.unities, function (e) {
- $(".js-new-unity").trigger("click");
- const unity = $(".unity").last();
- unity.find(".unity-name").val(this.name);
- unity.find(".unity-title").html(this.name);
- unity.find(".unity-id").val(this.id);
- unity
- .find("select.js-type-select")
- .val(this.type)
- .trigger("change");
- unity
- .find("select.js-formula-select")
- .val(this.grade_calculation_fk)
- .trigger("change");
-
- unity.find(".modality").remove();
- $.each(this.modalities, function (e) {
- unity.find(".js-new-modality").trigger("click");
- let modality = unity.find(".modality").last();
- modality.find(".modality-id").val(this.id);
- modality.find(".modality-name").val(this.name);
- modality.find(".modality-operation").val("update");
- modality.find(".weight").val(this.weight);
- });
+ $.each(data.unities, function () {
+ loadDataOnUnity(this, data.ruleType);
});
}
+
$(".grades-buttons").css("display", "flex");
$(
".js-grades-structure-container, .js-grades-rules-container"
@@ -694,10 +650,16 @@ function loadStructure() {
$("#accordion").accordion();
}
-$(document).on("keyup", ".approval-media, .final-recover-media", function (e) {
+$(document).on(
+ "keyup",
+ ".approval-media, .final-recover-media",
+ validateGradeFormat
+);
+
+function validateGradeFormat(event) {
let val = this.value;
if (!$.isNumeric(val)) {
- e.preventDefault();
+ event.preventDefault();
val = "";
} else {
const gradePattern = /^(100|\d{1,2}(\.\d)?)$|^\d(\.(\d)?)?$/;
@@ -711,23 +673,284 @@ $(document).on("keyup", ".approval-media, .final-recover-media", function (e) {
}
}
this.value = val;
-});
+}
+
+function loadDataOnUnity(unityData, ruleType) {
+ $("select.js-type-select").html(
+ ` Unidade por conceito `
+ );
+
+ if (ruleType === "N") {
+ $("select.js-type-select").html(`
Unidade
+
Unidade com recuperação `);
+ }
+
+ $(".js-new-unity").trigger("click");
+ const unity = $(".unity").last();
+ unity.find(".unity-name").val(unityData.name);
+ unity.find(".unity-title").html(unityData.name);
+ unity.find(".unity-id").val(unityData.id);
+ unity.find("select.js-type-select").select2("val", unityData.type);
+ unity
+ .find("select.js-formula-select")
+ .val(unityData.grade_calculation_fk)
+ .trigger("change");
+ unity.find(".modality").remove();
+
+ $.each(unityData.modalities, function () {
+ loadDataOnUnityModalities(unity, this);
+ });
+}
+
+function loadDataOnUnityModalities(unityDOM, modalityData) {
+ unityDOM.find(".js-new-modality").trigger("click");
+ let modality = unity.find(".modality").last();
+ modality.find(".modality-id").val(modalityData.id);
+ modality.find(".modality-name").val(modalityData.name);
+ modality.find(".modality-operation").val("update");
+ modality.find(".weight").val(modalityData.weight);
+}
function mostrarCamposSemestreOne() {
- const camposSemestreOne = document.getElementById('campos-primeiro-semestre');
- if (camposSemestreOne.style.display === 'none') {
- camposSemestreOne.style.display = 'block';
+ const camposSemestreOne = document.getElementById(
+ "campos-primeiro-semestre"
+ );
+ if (camposSemestreOne.style.display === "none") {
+ camposSemestreOne.style.display = "block";
} else {
- camposSemestreOne.style.display = 'none';
+ camposSemestreOne.style.display = "none";
}
}
function mostrarCamposSemestreTwo() {
- const camposSemestreTwo = document.getElementById('campos-segundo-semestre');
- if (camposSemestreTwo.style.display === 'none') {
- camposSemestreTwo.style.display = 'block';
+ const camposSemestreTwo = document.getElementById(
+ "campos-segundo-semestre"
+ );
+ if (camposSemestreTwo.style.display === "none") {
+ camposSemestreTwo.style.display = "block";
} else {
- camposSemestreTwo.style.display = 'none';
+ camposSemestreTwo.style.display = "none";
+ }
+}
+
+class UnityComponent extends HTMLElement {
+ static get observedAttributes() {
+ return ["index", "name", "type", "formula"];
+ }
+ constructor() {
+ super();
+ this.shadow = this.attachShadow({ mode: "open" });
+ this.render();
+ }
+
+ render() {
+ this.shadow.innerHTML = "";
+ this.shadow.appendChild(this.build());
+ this.shadow.appendChild(this.style());
+ }
+
+ // attribute change
+ attributeChangedCallback(property, oldValue, newValue) {
+ if (oldValue === newValue) return;
+ this[property] = newValue;
+ this.render();
+ }
+
+ style() {
+ const style = document.createElement("style");
+ style.textContent = `
+ @import '../themes/default/css/select2.css';
+ @import '../sass/css/main.css';
+ `;
+ return style;
+ }
+
+ build() {
+ const componentRoot = document.createElement("div");
+ const isUnityConcept = this.getAttribute("type") === "UC";
+
+ const typeItems = this._buildTypeItems();
+ const formulasItems = this._buildFormulasItems();
+
+ const unityHtml = template`
+
+
+
+
+
+
+ Nome:
+
+
+
+ Modelo:
+
+ ${typeItems}
+
+
+
+ Forma de cálculo:
+
+ ${formulasItems}
+
+
+
+
+
Modalidades avaliativas:
+
+ Gerencie todas as formas de avalição que compõe as notas dessa unidade avaliativa
+
+
+
+ Modalidade
+
+
+
+
+
`;
+
+ componentRoot.innerHTML = unityHtml;
+
+ // $(componentRoot).find(".js-type-select").select2("val", this.getAttribute("type"));
+
+ return componentRoot;
+ }
+
+ _buildTypeItems() {
+ const typesByConcept = [{ key: "UC", name: "Unidade por conceito" }];
+ const typesByNumeric = [
+ { key: "U", name: "Unidade" },
+ { key: "UR", name: "Unidade com Recuperação" },
+ ];
+
+ const types = isUnityConcept ? typesByConcept : typesByNumeric;
+
+ const optionBuilder = () => {
+ const isSelected =
+ this.getAttribute("type") === e.key ? "selected" : "";
+ return `
${e.name} `;
+ };
+
+ return types.map(optionBuilder);
+ }
+
+ _buildFormulasItems() {
+ const formulas = Array.from($(".formulas")[0].children).map((e) => {
+ return { key: e.value, name: e.innerHTML };
+ });
+
+ const optionBuilder = (e) => {
+ const isSelected =
+ this.getAttribute("formula") === e.key ? "selected" : "";
+ return `
${e.name} `;
+ };
+
+ const formulasItems = formulas.map(optionBuilder);
+
+ return formulasItems;
+ }
+}
+
+class UnityConceptComponent extends UnityComponent {}
+
+class UnityModalityComponent extends HTMLElement {
+ static get observedAttributes() {
+ return ["index", "name", "weight"];
+ }
+ constructor() {
+ super();
+
+ const shadow = this.attachShadow({ mode: "open" });
+ shadow.appendChild(this.build());
+ shadow.appendChild(this.styles());
+ }
+
+ styles() {
+ const style = document.createElement("style");
+ style.textContent = `
+ @import '../sass/css/main.css';
+ `;
+ return style;
+ }
+
+ build() {
+ const componentRoot = document.createElement("div");
+ componentRoot.setAttribute("class", "card");
+ const unityElement = $(this).closest(".unity");
+ const modalityHtml = template`
+
`;
+
+ componentRoot.innerHTML = modalityHtml;
+ return componentRoot;
+ }
+}
+
+class DefaultComponent extends HTMLElement {
+ static get observedAttributes() {
+ return [];
+ }
+ constructor(builder) {
+ super();
+
+ const shadow = this.attachShadow({ mode: "open" });
+ shadow.appendChild(builder());
+ shadow.appendChild(this.styles());
+ }
+
+ styles() {
+ const style = document.createElement("style");
+ style.textContent = `
+ @import '../sass/css/main.css';
+ `;
+ return style;
+ }
+
+ build() {
+ const componentRoot = document.createElement("div");
+ componentRoot.setAttribute("class", "card");
+
+ componentRoot.innerHTML = "
Unimplemented ";
+ return componentRoot;
}
}
+customElements.define("unity-component", UnityComponent);
+customElements.define("unity-concept-component", UnityConceptComponent);
+customElements.define("unity-modality-component", UnityModalityComponent);
diff --git a/themes/default/views/admin/gradesStructure.php b/themes/default/views/admin/gradesStructure.php
index e0246a9ae..aac8b6c4b 100644
--- a/themes/default/views/admin/gradesStructure.php
+++ b/themes/default/views/admin/gradesStructure.php
@@ -113,6 +113,16 @@
't-field-checkbox__label', 'id' => 'active-label')); ?>