]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed a bug when detecting a user as eligible for posting their name for high scores
authormark-nielsen <mark-nielsen>
Tue, 19 Sep 2006 02:41:10 +0000 (02:41 +0000)
committermark-nielsen <mark-nielsen>
Tue, 19 Sep 2006 02:41:10 +0000 (02:41 +0000)
mod/lesson/view.php

index 151168d4f3c15ac2b93cb580728f00247aaca4e6..abbdf6a64933e454dbaf92059e9722fa03dff374 100644 (file)
                 $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;
                     }
                 }