Some browsers do not bubble form submission events to the window, and we
had more than one form on the page in certain conditions. We need to select
all of the forms on a page and then test the action.
question_type::save_question_answers function added, supporting
saving answers and extra answer fields. It can be called from
save_question_options function for the questions, using
question_answers table. Special functions created for overloading
so that every question could tune it to it's own form.
Shortanswer qtype save_question_options() converted as a proof of
concept and for testing purposes.
Now question_edit_form can load extra answer fields. If a question
type need to do something more complex for particular field, it
can overload added functions without duplicating other code.
Extra answer data may be optional, saving DB space - i.e. not every row in
question_answers will have respective row in extra answers table. Current
implementation of question_type::get_question_options() won't return such
answers at all. This commit fix that, changing join type for db query.
Also fixed coding style violation in the variable name in get_question_options.
The sequence of questions that made up a quiz used to be stored as a
comma-separated list in quiz.questions. Now the same information is
stored in the rows in the quiz_slots table. This is not just 'better' in
a database design sense, but it allows for the future changes we will
need as we enhance the quiz in the MDL-40987 epic.
Having changed the database structure, all the rest of the code needs to
be changed to account for it, and that is done here.
Note that there are not many unit tests for the changed bit. That is
because as part of MDL-40987 we will be changing the code further, and
we will add unit tests then.
The following used steps were replaced by the ones
added in this issue:
- I fill the moodle form with
- I fill in with
- I select from
- I select radio button
- I check
- I uncheck
- the field should match
Also removing test for deprecated steps:
- the ASD checkbox should be checked
- the ASD checkbox should not be checked
This data should all have been upgraded when moving to Moodle 2.1. It
was only kept as a back-up, and now, after 3 years have past, we can
clean it up.
In Moodle 2.1, there was a major DB upgrade relating to questions, and
it was possible to delay some of that upgrade. Now, those DB tables are
changing again, and the time has come to insist that all the updata has
been upgraded (or deleted).