Skip to content

Commit

Permalink
GH-220 clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
eynimeni committed Jan 11, 2024
1 parent e5566af commit d154497
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions classes/teststrategy/feedbackgenerator/personabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit d154497

Please sign in to comment.