Skip to content

Commit

Permalink
Fixed a bug when detecting a user as eligible for posting their name …
Browse files Browse the repository at this point in the history
…for high scores
  • Loading branch information
mark-nielsen committed Sep 19, 2006
1 parent 8271e5c commit 2817bc1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mod/lesson/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 2817bc1

Please sign in to comment.