Index: quiz.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/quiz/quiz.module,v
retrieving revision 1.138.2.310
diff -u -p -r1.138.2.310 quiz.module
--- quiz.module	14 Nov 2010 12:55:15 -0000	1.138.2.310
+++ quiz.module	15 Nov 2010 12:18:58 -0000
@@ -1407,7 +1407,7 @@ function quiz_get_all_version_titles() {
 }
 
 /**
- * Return score data for given quizzes.
+ * Return highest score data for given quizzes.
  *
  * @param $nids
  *   nids for the quizzes we want to collect scores from.
@@ -1418,6 +1418,7 @@ function quiz_get_all_version_titles() {
  *   This adds a performance hit.
  * @return
  *   Array of score data.
+ *   For several takes on the same quiz, only returns highest score.
  */
 function quiz_get_score_data($nids, $uid, $include_num_questions = FALSE) {
   // Validate that the nids are integers.
@@ -1452,7 +1453,9 @@ function quiz_get_score_data($nids, $uid
     if (!$include_num_questions) {
       unset($res_o->num_random_questions);
     }
-    $to_return[$res_o->vid] = $res_o;
+    if (!isset($to_return[$res_o->vid]) || $res_o->percent_score > $to_return[$res_o->vid]->percent_score) {
+      $to_return[$res_o->vid] = $res_o;  // Fetch highest score
+    }
     // $vids will be used to fetch number of questions.
     $vids[] = $res_o->vid;
   }
