From OU bug #921 "Order of answer fields in Variable numeric keeps changing" Cannot
reproduce this bug on my system but hopefully this will fix the problem. I added
an ORDER BY clause to the sql for fetching answers with extra answer fields.
There was one place where I had only fixed the backup code to work-around bad data from Moodle 2.0. I needed to make the equivalent change in the upgrade code.
The bad data is that the seq_number fields can be wrong (not unique). Se already have data ordered by (seq_number, id) and the array keys of the array we are building are not used for anything, so this fix deals with the problem.
1. We need this so that, for example, when previewing a question from
the quiz editing page, the preview uses the filter settings, theme and
language set for that quiz and course.
Probably easiest to explain by example: If the right answer is 1.23 m with alternate
unit 100 cm = 1m then the completely right answers are 1.23 m and 123 cm.
Right answer, wrong unit responses include 1.23, 1.23 frogs and 1.23 cm.
123 m is not considered to have the correct numerical value.
We may well re-consider the way this works in a future version of Moodle.
Unit grading was not implemented before Moodle 2.0. In Moodle 2.0, the unit grading
was more permissive than here, for example 123 m would have been graded correctly in
2.0. However, I'm not sure I follow the rationale for that.
It seems that people want to be able to use <sup> and <sub> here, which
makes sense, so we need to keep radio buttons for questions upgraded
from 2.0. The dropdown menu, however, is also nice, so keep that option
too for new questions.
There were two main problems:
1. The unit tests for upgrading adaptive quiz attempts had slighly the
wrong $expectedqa, and so matching that the upgrade was doing the wrong
thing in certain situations. The main issue was that it was setting
-_try = 1 on the first step, which broke the penalty calculation when
the quiz was regraded. There were also some other subtleties with
incrementing -_try that were not right before.
2. It was possible in 2.0 and earlier for two question_states to get the
same seq_number, and restoring 2.0 backups was rashly assuming that that
was unique.