MDL-11213 - Quiz preview attempts show up in item analysis. Fix thanks to Jean-Michel Vedrine. Merged from MOODLE_18_STABLE.

This commit is contained in:
tjhunt 2007-09-13 16:25:00 +00:00
parent aae94377b7
commit 8472a14d71

View File

@ -68,7 +68,10 @@ class quiz_report extends quiz_default_report {
}
if ($attemptselection != QUIZ_ALLATTEMPTS) {
$sql = 'SELECT qa.userid '.$limit.'FROM '.$CFG->prefix.'user u LEFT JOIN '.$CFG->prefix.'quiz_attempts qa ON u.id = qa.userid '. 'WHERE ( qa.quiz = '.$quiz->id.') '.$group;
$sql = 'SELECT qa.userid '.$limit.
'FROM '.$CFG->prefix.'user u LEFT JOIN '.$CFG->prefix.'quiz_attempts qa ON u.id = qa.userid '.
'WHERE qa.quiz = '.$quiz->id.' AND qa.preview = 0 '.
$group;
$usermax = get_records_sql_menu($sql);
}
@ -82,7 +85,7 @@ class quiz_report extends quiz_default_report {
}
$sql = 'SELECT qa.* FROM '.$CFG->prefix.'quiz_attempts qa, '.$CFG->prefix.'user u '.$groupmembers.
'WHERE u.id = qa.userid AND qa.quiz = '.$quiz->id.' AND ( qa.sumgrades >= '.$scorelimit.' ) '.$groupwhere;
'WHERE u.id = qa.userid AND qa.quiz = '.$quiz->id.' AND qa.preview = 0 AND ( qa.sumgrades >= '.$scorelimit.' ) '.$groupwhere;
// ^^^^^^ es posible seleccionar aqu<71> TODOS los quizzes, como quiere Jussi,
// pero habr<62>a que llevar la cuenta ed cada quiz para restaura las preguntas (quizquestions, states)
@ -91,7 +94,7 @@ class quiz_report extends quiz_default_report {
$attempts = get_records_sql($sql);
if(empty($attempts)) {
($strnoattempts);
print_heading(get_string('nothingtodisplay'));
$this->print_options_form($quiz, $cm, $attemptselection, $lowmarklimit, $pagesize);
return true;
}