MDL-59606 quiz responses: fix edge cases in the report
This patch conbines valuable contributions from Kashmira Nagwekar and Luca Bösch. Many thanks to them. However, the final form of the fix, and hence the blame, falls to me -- Tim. There were several issues here: * The load_questions_usages_by_activity method in question/engine/datalib.php was incorrectly treating the case when no data was returned. (Looks like a historic copy-pase from other methods that fetch one item by unique id, which therefore must exist.) * The report was not correctly handling the display when the 'Which tries' was set to 'with, and without, attempts'. * It was possible to select the 'All tries' option when also saying 'Users without attempts'. This combination makes not sense, so a disabledIf rule was added to the form.
This commit is contained in:
@@ -525,15 +525,11 @@ ORDER BY
|
||||
qas.sequencenumber
|
||||
", $qubaids->usage_id_in_params());
|
||||
|
||||
if (!$records->valid()) {
|
||||
throw new coding_exception('Failed to load questions_usages_by_activity for qubaid_condition :' . $qubaids);
|
||||
}
|
||||
|
||||
$qubas = array();
|
||||
do {
|
||||
while ($records->valid()) {
|
||||
$record = $records->current();
|
||||
$qubas[$record->qubaid] = question_usage_by_activity::load_from_records($records, $record->qubaid);
|
||||
} while ($records->valid());
|
||||
}
|
||||
|
||||
$records->close();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user