| @@ 2291-2300 (lines=10) @@ | ||
| 2288 | $max_note = api_get_setting('exercise_max_score'); |
|
| 2289 | $min_note = api_get_setting('exercise_min_score'); |
|
| 2290 | ||
| 2291 | if ($use_platform_settings) { |
|
| 2292 | if ($max_note != '' && $min_note != '') { |
|
| 2293 | if (!empty($weight) && intval($weight) != 0) { |
|
| 2294 | $score = $min_note + ($max_note - $min_note) * $score / $weight; |
|
| 2295 | } else { |
|
| 2296 | $score = $min_note; |
|
| 2297 | } |
|
| 2298 | $weight = $max_note; |
|
| 2299 | } |
|
| 2300 | } |
|
| 2301 | $percentage = (100 * $score) / ($weight != 0 ? $weight : 1); |
|
| 2302 | ||
| 2303 | // Formats values |
|
| @@ 2427-2435 (lines=9) @@ | ||
| 2424 | $max_note = api_get_setting('exercise_max_score'); |
|
| 2425 | $min_note = api_get_setting('exercise_min_score'); |
|
| 2426 | ||
| 2427 | if ($score != '' && $weight != '') { |
|
| 2428 | if ($max_note != '' && $min_note != '') { |
|
| 2429 | if (!empty($weight)) { |
|
| 2430 | $score = $min_note + ($max_note - $min_note) * $score / $weight; |
|
| 2431 | } else { |
|
| 2432 | $score = $min_note; |
|
| 2433 | } |
|
| 2434 | } |
|
| 2435 | } |
|
| 2436 | $score_rounded = float_format($score, 1); |
|
| 2437 | ||
| 2438 | return $score_rounded; |
|