Skip to content

Commit

Permalink
Fix/php8 (#866)
Browse files Browse the repository at this point in the history
* first commit

* fix calculate numeric grades

---------

Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>
  • Loading branch information
GabrielChagas14 and gabriel-IPTI authored Nov 6, 2024
1 parent b694401 commit efd3696
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/domain/grades/usecases/CalculateNumericGradeUsecase.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ private function calculateFinalRecoveryMedia($enrollment, $disciplineId, $unity)
private function applyStrategyComputeGradesByFormula($calculation, $unityOrRecovery, $grades, $isRecovery)
{
$result = 0;

if(empty($grades)){ return 0; }

switch ($calculation) {
default:
case 'Soma':
Expand Down
5 changes: 3 additions & 2 deletions app/modules/courseplan/controllers/CourseplanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,10 @@ public function actionSave($id = null)
TLog::info("Aula salva com sucesso", ['CourseClassId' => $courseClass->id, 'CoursePlanId' => $coursePlan->id]);
}

array_push($courseClassIds, $courseClass->id);
$courseClassIds[] = $courseClass->id;

CourseClassHasClassAbility::model()->deleteAll("course_class_fk = :course_class_fk and course_class_ability_fk not in ( '" . implode("', '", $cc['ability']) . "' )", [":course_class_fk" => $courseClass->id]);
$abilitiesMerged = is_array($cc['ability']) ? implode("', '", $cc['ability']): $cc['ability'];
CourseClassHasClassAbility::model()->deleteAll("course_class_fk = :course_class_fk and course_class_ability_fk not in ( '" . $abilitiesMerged . "' )", [":course_class_fk" => $courseClass->id]);
foreach ($cc["ability"] as $abilityId) {
$courseClassHasClassAbility = CourseClassHasClassAbility::model()->find("course_class_fk = :course_class_fk and course_class_ability_fk = :course_class_ability_fk", ["course_class_fk" => $courseClass->id, "course_class_ability_fk" => $abilityId]);
if ($courseClassHasClassAbility == null) {
Expand Down

0 comments on commit efd3696

Please sign in to comment.