Index: mod/quiz/report/reportlib.php =================================================================== RCS file: /home/cvs_repositories/globalcvs/ou-moodle/mod/quiz/report/reportlib.php,v retrieving revision 1.9 diff -u -r1.9 reportlib.php --- mod/quiz/report/reportlib.php 24 Apr 2009 10:35:19 -0000 1.9 +++ mod/quiz/report/reportlib.php 18 Sep 2009 11:32:57 -0000 @@ -157,6 +157,9 @@ function quiz_get_average_grade_for_questions($quiz, $userids){ global $CFG; $qmfilter = quiz_report_qm_filter_select($quiz); + if ($qmfilter) { + $qmfilter = '(' . $qmfilter . ') AND'; + } // ou-specific begins (until 2.0) /* Comment out Moodle core code $questionavgssql = "SELECT qs.question, AVG(qs.grade) FROM " . @@ -176,7 +179,7 @@ LEFT JOIN {$CFG->prefix}question_sessions qns ON (qns.attemptid = qa.uniqueid) LEFT JOIN {$CFG->prefix}question_states qs ON (qns.newgraded = qs.id AND qs.event IN (".QUESTION_EVENTS_GRADED.")) WHERE " . - "($qmfilter) AND " . + "$qmfilter " . "qa.userid $usql AND " . "qa.quiz = $quiz->id ". "GROUP BY qns.questionid"; Index: mod/quiz/report/overview/overview_table.php =================================================================== RCS file: /home/cvs_repositories/globalcvs/ou-moodle/mod/quiz/report/overview/overview_table.php,v retrieving revision 1.6 diff -u -r1.6 overview_table.php --- mod/quiz/report/overview/overview_table.php 23 Oct 2008 15:05:59 -0000 1.6 +++ mod/quiz/report/overview/overview_table.php 18 Sep 2009 11:32:57 -0000 @@ -51,7 +51,7 @@ $groupaveragerow = array($namekey => get_string('groupavg', 'grades'), 'sumgrades' => round($groupaverage->grade, $this->quiz->decimalpoints), 'feedbacktext'=> strip_tags(quiz_report_feedback_for_grade($groupaverage->grade, $this->quiz->id))); - if($this->detailedmarks && $this->qmsubselect) { + if($this->detailedmarks && ($this->qmsubselect || $this->quiz->attempts == 1)) { $avggradebyq = quiz_get_average_grade_for_questions($this->quiz, $this->groupstudents); $groupaveragerow += quiz_format_average_grade_for_questions($avggradebyq, $this->questions, $this->quiz, $this->is_downloading()); } @@ -63,7 +63,7 @@ $overallaveragerow = array($namekey => get_string('overallaverage', 'grades'), 'sumgrades' => round($overallaverage->grade, $this->quiz->decimalpoints), 'feedbacktext'=> strip_tags(quiz_report_feedback_for_grade($overallaverage->grade, $this->quiz->id))); - if($this->detailedmarks && $this->qmsubselect) { + if($this->detailedmarks && ($this->qmsubselect || $this->quiz->attempts == 1)) { $avggradebyq = quiz_get_average_grade_for_questions($this->quiz, $this->students); $overallaveragerow += quiz_format_average_grade_for_questions($avggradebyq, $this->questions, $this->quiz, $this->is_downloading()); }