From d1544974995f2156afb77997d28e2a09c11fa71c Mon Sep 17 00:00:00 2001 From: Magdalena Holczik Date: Thu, 11 Jan 2024 12:41:57 +0100 Subject: [PATCH] GH-220 clean code --- .../teststrategy/feedbackgenerator/personabilities.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/classes/teststrategy/feedbackgenerator/personabilities.php b/classes/teststrategy/feedbackgenerator/personabilities.php index 89aec1e83..9d6080e95 100644 --- a/classes/teststrategy/feedbackgenerator/personabilities.php +++ b/classes/teststrategy/feedbackgenerator/personabilities.php @@ -326,7 +326,9 @@ private function render_abilityprofile_chart(array $initialcontext, $primarycats $abilitysteps = []; $abilitystep = 0.25; $interval = $abilitystep * 2; - for ($i = LOCAL_CATQUIZ_PERSONABILITY_LOWER_LIMIT + $abilitystep; $i <= LOCAL_CATQUIZ_PERSONABILITY_UPPER_LIMIT - $abilitystep; $i += $interval) { + for ($i = LOCAL_CATQUIZ_PERSONABILITY_LOWER_LIMIT + $abilitystep; + $i <= LOCAL_CATQUIZ_PERSONABILITY_UPPER_LIMIT - $abilitystep; + $i += $interval) { $abilitysteps[] = $i; } @@ -416,8 +418,8 @@ private function render_abilityprofile_chart(array $initialcontext, $primarycats private function round_to_customsteps(float $number, float $step, float $interval):float { $roundedvalue = round($number / $step) * $step; - // Exclude rounding to steps with 0.5 - if ($roundedvalue - floor($roundedvalue) == 0.5) { + // Exclude rounding to steps defined in $interval. + if ($roundedvalue - floor($roundedvalue) == $interval) { $roundedvalue = floor($roundedvalue) + $step; }