| @@ 2291-2300 (lines=10) @@ | ||
| 2288 | $maxNote = api_get_setting('exercise_max_score'); |
|
| 2289 | $minNote = api_get_setting('exercise_min_score'); |
|
| 2290 | ||
| 2291 | if ($use_platform_settings) { |
|
| 2292 | if ($maxNote != '' && $minNote != '') { |
|
| 2293 | if (!empty($weight) && intval($weight) != 0) { |
|
| 2294 | $score = $minNote + ($maxNote - $minNote) * $score / $weight; |
|
| 2295 | } else { |
|
| 2296 | $score = $minNote; |
|
| 2297 | } |
|
| 2298 | $weight = $maxNote; |
|
| 2299 | } |
|
| 2300 | } |
|
| 2301 | $percentage = (100 * $score) / ($weight != 0 ? $weight : 1); |
|
| 2302 | ||
| 2303 | // Formats values |
|
| @@ 2507-2515 (lines=9) @@ | ||
| 2504 | $maxNote = api_get_setting('exercise_max_score'); |
|
| 2505 | $minNote = api_get_setting('exercise_min_score'); |
|
| 2506 | ||
| 2507 | if ($score != '' && $weight != '') { |
|
| 2508 | if ($maxNote != '' && $minNote != '') { |
|
| 2509 | if (!empty($weight)) { |
|
| 2510 | $score = $minNote + ($maxNote - $minNote) * $score / $weight; |
|
| 2511 | } else { |
|
| 2512 | $score = $minNote; |
|
| 2513 | } |
|
| 2514 | } |
|
| 2515 | } |
|
| 2516 | $score_rounded = float_format($score, 1); |
|
| 2517 | ||
| 2518 | return $score_rounded; |
|