MDL-59606 quiz responses: fix edge cases in the report
authorTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 31 Jul 2017 16:58:29 +0000 (18:58 +0200)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 27 Oct 2017 15:57:01 +0000 (16:57 +0100)
commitdae0ccfc451f9b6e342c72ed5e775d6a5426035d
tree1cfba55b253c6824b4ec4f3b7e547a2c0a6596a1
parent40f1801c4b3b6e4f964cb439cd7866bf88320a6e
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.
mod/quiz/report/overview/tests/behat/basic.feature
mod/quiz/report/responses/first_or_all_responses_table.php
mod/quiz/report/responses/responses_form.php
mod/quiz/report/responses/tests/behat/basic.feature [new file with mode: 0644]
question/engine/datalib.php
question/type/numerical/tests/helper.php