From 239f2b9c8a19773fbee5d8abfc4389cd251aee62 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Fri, 4 Sep 2020 17:57:38 -0500 Subject: [PATCH] Minor - Flint fixes --- main/gradebook/lib/be/exerciselink.class.php | 4 +- main/gradebook/lib/scoredisplay.class.php | 66 ++++++++++---------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/main/gradebook/lib/be/exerciselink.class.php b/main/gradebook/lib/be/exerciselink.class.php index 86f72f1102..c274c9832c 100755 --- a/main/gradebook/lib/be/exerciselink.class.php +++ b/main/gradebook/lib/be/exerciselink.class.php @@ -10,12 +10,12 @@ */ class ExerciseLink extends AbstractLink { + // This variable is used in the WSGetGradebookUserItemScore service, to check base course tests. + public $checkBaseExercises = false; private $course_info; private $exercise_table; private $exercise_data = []; private $is_hp; - // This variable is used in the WSGetGradebookUserItemScore service, to check base course tests. - public $checkBaseExercises = false; /** * @param int $hp diff --git a/main/gradebook/lib/scoredisplay.class.php b/main/gradebook/lib/scoredisplay.class.php index 86fc983346..1218762407 100755 --- a/main/gradebook/lib/scoredisplay.class.php +++ b/main/gradebook/lib/scoredisplay.class.php @@ -340,6 +340,39 @@ class ScoreDisplay return $display; } + /** + * Depends on the teacher's configuration of thresholds. i.e. [0 50] "Bad", [50:100] "Good". + * + * @param array $score + * + * @return string + */ + public function display_custom($score) + { + if (empty($score)) { + return null; + } + + $my_score_denom = $score[1] == 0 ? 1 : $score[1]; + $scaledscore = $score[0] / $my_score_denom; + + if ($this->upperlimit_included) { + foreach ($this->custom_display_conv as $displayitem) { + if ($scaledscore <= $displayitem['score']) { + return $displayitem['display']; + } + } + } else { + if (!empty($this->custom_display_conv)) { + foreach ($this->custom_display_conv as $displayitem) { + if ($scaledscore < $displayitem['score'] || $displayitem['score'] == 1) { + return $displayitem['display']; + } + } + } + } + } + /** * Get current gradebook category id. * @@ -488,39 +521,6 @@ class ScoreDisplay return $score[0].' / '.$score[1]; } - /** - * Depends on the teacher's configuration of thresholds. i.e. [0 50] "Bad", [50:100] "Good". - * - * @param array $score - * - * @return string - */ - public function display_custom($score) - { - if (empty($score)) { - return null; - } - - $my_score_denom = $score[1] == 0 ? 1 : $score[1]; - $scaledscore = $score[0] / $my_score_denom; - - if ($this->upperlimit_included) { - foreach ($this->custom_display_conv as $displayitem) { - if ($scaledscore <= $displayitem['score']) { - return $displayitem['display']; - } - } - } else { - if (!empty($this->custom_display_conv)) { - foreach ($this->custom_display_conv as $displayitem) { - if ($scaledscore < $displayitem['score'] || $displayitem['score'] == 1) { - return $displayitem['display']; - } - } - } - } - } - /** * Get score color percent by category. *