Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/ipti/br.tag
Browse files Browse the repository at this point in the history
  • Loading branch information
igorgoncalves committed Dec 27, 2024
2 parents 765a3e7 + d9cbd9b commit e6b0d7d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/GradesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ public function actionSaveGrades()
$stage = Yii::app()->request->getPost("stage");
$isConcept = Yii::app()->request->getPost("isConcept");

$transaction = Yii::app()->db->beginTransaction();
try {
foreach ($students as $student) {
foreach ($student["grades"] as $grade) {
Expand Down Expand Up @@ -589,10 +590,12 @@ public function actionSaveGrades()
}
}
self::saveGradeResults($classroomId, $disciplineId, $stage);
$transaction->commit();
header('HTTP/1.1 200 OK');
echo json_encode(["valid" => true]);
} catch (Exception $e) {
TLog::error("Ocorreu algum erro durante a transação de SaveGrades", ["ExceptionMessage" => $e->getMessage()]);
$transaction->rollback();
throw new Exception($e->getMessage(), 500, $e);
}

Expand Down Expand Up @@ -626,6 +629,7 @@ public function actionGetGrades()

public function actionCalculateFinalMedia()
{
$transaction = Yii::app()->db->beginTransaction();
try {
$classroomId = Yii::app()->request->getPost("classroom");
$stage = Yii::app()->request->getPost("stage");
Expand Down Expand Up @@ -669,7 +673,9 @@ public function actionCalculateFinalMedia()
}

}
$transaction->commit();
} catch (Exception $e) {
$transaction->rollback();
TLog::error("Erro ao atualizar status da matrícula", ["Exception" => $e]);
}

Expand Down

0 comments on commit e6b0d7d

Please sign in to comment.