Skip to content

Commit

Permalink
codechecker fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TamaroWalter committed Jan 18, 2024
1 parent 787f5e0 commit d446773
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions classes/ratings.php
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ private static function moodleoverflow_quicksort_posts(array &$posts, $low, $hig
$pivot = 0;
if ($sortby == 'votesdifference') {
$pivot = $posts[intval(($low + $high) / 2)]->votesdifference;
} else if ($sortby == 'modified'){
} else if ($sortby == 'modified') {
$pivot = $posts[intval(($low + $high) / 2)]->modified;
}
do {
Expand Down Expand Up @@ -869,8 +869,8 @@ private static function moodleoverflow_quicksort_posts(array &$posts, $low, $hig
}

/**
* Helper function for moodleoverflow_sort_answer_by_rating. For posts that have the same mark and votesdifference, the posts are
* sorted by time modified
* Helper function for moodleoverflow_sort_answer_by_rating. For posts that have the same mark and votesdifference,
* the posts are sorted by time modified
* @param array $posts The array that will be sorted
* @param int $low Startindex from where equal votes will be checked
* @param int $high Endindex until where equal votes will be checked
Expand All @@ -881,10 +881,11 @@ private static function moodleoverflow_check_equal_votes(&$posts, $low, $high) {
if ($posts[$low]->votesdifference == $posts[$low + 1]->votesdifference) {
$tempstartindex = $low;
$tempendindex = $tempstartindex + 1;
while (($tempendindex + 1 <= $high) && ($posts[$tempendindex]->votesdifference == $posts[$tempendindex + 1]->votesdifference)) {
while (($tempendindex + 1 <= $high) &&
($posts[$tempendindex]->votesdifference == $posts[$tempendindex + 1]->votesdifference)) {
$tempendindex++;
}
self::moodleoverflow_quicksort_posts($posts,$tempstartindex, $tempendindex, 'modified');
self::moodleoverflow_quicksort_posts($posts, $tempstartindex, $tempendindex, 'modified');
$low = $tempendindex + 1;
} else {
$low++;
Expand Down

0 comments on commit d446773

Please sign in to comment.