From: mark-nielsen Date: Tue, 19 Sep 2006 02:41:10 +0000 (+0000) Subject: Fixed a bug when detecting a user as eligible for posting their name for high scores X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2817bc1aed3a7f87711f00499373b1dee4f0d86c;p=moodle.git Fixed a bug when detecting a user as eligible for posting their name for high scores --- diff --git a/mod/lesson/view.php b/mod/lesson/view.php index 151168d4f3..abbdf6a649 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -943,15 +943,18 @@ $madeit = false; if ($highscores = get_records_select("lesson_high_scores", "lessonid = $lesson->id")) { // get all the high scores into an array + $topscores = array(); + $uniquescores = array(); foreach ($highscores as $highscore) { $grade = $grades[$highscore->gradeid]->grade; $topscores[] = $grade; + $uniquescores[$grade] = 1; } // sort to find the lowest score sort($topscores); $lowscore = $topscores[0]; - if ($gradeinfo->grade >= $lowscore || count($topscores) <= $lesson->maxhighscores) { + if ($gradeinfo->grade >= $lowscore || count($uniquescores) <= $lesson->maxhighscores) { $madeit = true; } }