123456789101112131415161718192021222324252627 |
- <?php
-
- if (!function_exists('calcExtraCredits')) {
- /**
- * Calculates extra credits according to http://www.upr.edu/mdocs-posts/certificacion-num-60-2015-2016-enmienda-a-la-cert-105/
- * @param float $credits
- * @param int $student_count
- * @param bool $grad True if graduate course
- * @return float
- */
- function calcExtraCredits($credits, $student_count, $grad = false)
- {
- return max(0, round(($credits ?? 0) * (($student_count ?? 0) - ($grad ? 60 : 30)) / ($grad ? 60 : 30)) / 2);
- }
- }
-
- if (!function_exists('cmpCourseCode')) {
- /**
- * Compares courses by last 4 digits or first 4 characters if digits are equal
- * @param Course $c1, $c2
- * @return int
- */
- function cmpCourseCode($c1, $c2) {
- return (substr($c1->code, -4) - substr($c2->code, -4)) ?: strcmp($c1->code, $c2->code);
- }
-
- }
|