From cb8057dee24a40541c80c1fc19b7ab9df623ac49 Mon Sep 17 00:00:00 2001 From: defacer Date: Thu, 27 Jan 2005 02:39:15 +0000 Subject: [PATCH] Semantically it's better if quiz_get_best_grade returns NULL if there is no such grade. --- mod/quiz/index.php | 2 +- mod/quiz/locallib.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mod/quiz/index.php b/mod/quiz/index.php index 3f2eb4df36..a6440bc1af 100644 --- a/mod/quiz/index.php +++ b/mod/quiz/index.php @@ -107,7 +107,7 @@ $gradecol = ""; } } else { - if ($bestgrade === "" or $quiz->grade == 0) { + if ($bestgrade === NULL || $quiz->grade == 0) { $gradecol = ""; } else { $gradecol = "$bestgrade / $quiz->grade"; diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index e3d4540bb5..e78b5fdb38 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -1440,11 +1440,11 @@ function quiz_get_user_attempts_string($quiz, $attempts, $bestgrade) { function quiz_get_best_grade($quizid, $userid) { /// Get the best current grade for a particular user in a quiz - if (!$grade = get_record("quiz_grades", "quiz", $quizid, "userid", $userid)) { - return ""; + if (!$grade = get_record('quiz_grades', 'quiz', $quizid, 'userid', $userid)) { + return NULL; } - return (round($grade->grade,0)); + return (round($grade->grade)); } function quiz_save_best_grade($quiz, $userid) { -- 2.39.5