From ec65c6ad7caef079a8734615f6fe7d5f6aaf4dec Mon Sep 17 00:00:00 2001 From: gustav_delius Date: Sat, 8 Apr 2006 08:13:26 +0000 Subject: [PATCH] This has extra code to exclude preview attempts from the grading --- mod/quiz/report/grading/report.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/mod/quiz/report/grading/report.php b/mod/quiz/report/grading/report.php index a6157ce077..348cf798c4 100644 --- a/mod/quiz/report/grading/report.php +++ b/mod/quiz/report/grading/report.php @@ -1,4 +1,4 @@ -Concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).' AS userattemptid, @@ -139,11 +144,16 @@ class quiz_report extends quiz_default_report { $where = 'WHERE qa.id='.$attemptid.' '; } + // ignore previews + $where .= ' AND preview = 0'; + $where .= 'AND '.$db->IfNull('qa.attempt', '0').' != 0 '; $where .= 'AND '.$db->IfNull('qa.timefinish', '0').' != 0 '; $sort = 'ORDER BY u.firstname, u.lastname, qa.attempt ASC'; $attempts = get_records_sql($select.$from.$where.$sort); + // Display the form with one part for each selected attempt + echo '
'. ''. ''. @@ -210,7 +220,7 @@ class quiz_report extends quiz_default_report { " {$CFG->prefix}quiz_question_instances i". " WHERE i.quiz = '$quiz->id' AND q.id = i.question". " AND q.id IN ($questionlist)". - " AND q.qtype = '".ESSAY."'". + " AND q.qtype = 'essay'". " ORDER BY q.name"; if (empty($questionlist) or !$questions = get_records_sql($sql)) { print_heading(get_string('noessayquestionsfound', 'quiz')); @@ -218,7 +228,7 @@ class quiz_report extends quiz_default_report { exit(); } // get all the finished attempts by the users - if ($attempts = get_records_select('quiz_attempts', "quiz = $quiz->id and timefinish > 0 and userid IN ($userids)", 'userid, attempt')) { + if ($attempts = get_records_select('quiz_attempts', "quiz = $quiz->id and timefinish > 0 AND userid IN ($userids) AND preview = 0", 'userid, attempt')) { foreach($questions as $question) { $link = "id&action=viewquestion&questionid=$question->id\">". @@ -283,7 +293,8 @@ class quiz_report extends quiz_default_report { $where = 'WHERE u.id IN ('.implode(',', array_keys($users)).') '; $where .= 'AND '.$db->IfNull('qa.attempt', '0').' != 0 '; $where .= 'AND '.$db->IfNull('qa.timefinish', '0').' != 0 '; - + $where .= 'AND preview = 0 '; // ignore previews + if($table->get_sql_where()) { // forgot what this does $where .= 'AND '.$table->get_sql_where(); } -- 2.39.5