From: jamiesensei Date: Thu, 19 Jun 2008 15:24:27 +0000 (+0000) Subject: MDL-15165 "Essay quiz Manual grading "these are no attempts to show" when there are... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0b8953aec3614177e6e39d0087b355fc83217c07;p=moodle.git MDL-15165 "Essay quiz Manual grading "these are no attempts to show" when there are actually attempts" - not resolved. But while reviewing the query I found a LIMIT clause in sql that I've replace with params to the get_records_sql function. Also made the logic in attempt_sql method more robust. Merged from 1.9 --- diff --git a/mod/quiz/report/grading/report.php b/mod/quiz/report/grading/report.php index 6270b209fb..5df665bb17 100644 --- a/mod/quiz/report/grading/report.php +++ b/mod/quiz/report/grading/report.php @@ -349,11 +349,10 @@ class quiz_report extends quiz_default_report { $sort = 'ORDER BY u.firstname, u.lastname, qa.attempt ASC'; if ($gradenextungraded){ - $limit = ' LIMIT '.QUIZ_REPORT_DEFAULT_GRADING_PAGE_SIZE; + $attempts = $DB->get_records_sql($select.$from.$where.$sort, $params, 0, QUIZ_REPORT_DEFAULT_GRADING_PAGE_SIZE); } else { - $limit = ''; + $attempts = $DB->get_records_sql($select.$from.$where.$sort, $params); } - $attempts = $DB->get_records_sql($select.$from.$where.$sort.$limit, $params); if ($attempts){ $firstattempt = current($attempts); $fullname = fullname($firstattempt); @@ -432,7 +431,7 @@ class quiz_report extends quiz_default_report { // this sql joins the attempts table and the user table $select = 'SELECT qa.id AS attemptid, qa.uniqueid, qa.attempt, qa.timefinish, qa.preview, u.id AS userid, u.firstname, u.lastname, u.picture '; - if ($wantstateevent){ + if ($wantstateevent && $questionid){ $select .= ', qs.event '; } $from = 'FROM {user} u, ' .