calculate_grade_points ( string $grade, float $credits )

Calculates grade points for stac.

Return: (mixed)

Source file: app/functions/student-function.php

View source


Parameters

$grade

(string) (Required) Letter grade.

$credits

(float) (Required) Number of course credits.



Source

function calculate_grade_points($grade, $credits)
{
    $app = \Liten\Liten::getInstance();
    try {
        $gp = $app->db->grade_scale()
            ->select('points')
            ->where('grade = ?', $grade);
        $q = $gp->find();
        foreach ($q as $r) {
            $gradePoints = _h($r->points) * $credits;
        }
        return $gradePoints;
    } catch (NotFoundException $e) {
        Cascade::getLogger('error')->error($e->getMessage());
        _etsis_flash()->error(_etsis_flash()->notice(409));
    } catch (ORMException $e) {
        Cascade::getLogger('error')->error($e->getMessage());
        _etsis_flash()->error(_etsis_flash()->notice(409));
    } catch (Exception $e) {
        Cascade::getLogger('error')->error($e->getMessage());
        _etsis_flash()->error(_etsis_flash()->notice(409));
    }
}


Changelog

  • Since: eduTrac SIS 6.3.0

User Contributed Notes

You must log in before being able to contribute a note.