The common cartridge backup was skipping
quizzes because the <questions> element
is no longer in the Moodle backup file.
Instead, now reading from the list of
<question_instances> list.
When we restore a course, the grade that a user has for the
grade item of the course cannot be created twice. If we try
to create it when it already exists, a database exception is
raised because of index duplication.
The safest way to proceed is certainly to ignore the grade
information from the backup, otherwise we could potentially
overwrite existing information. Though, this only applies
to restore as merge, and it does not affect the update of
the course grade.
Replace a hardcoded div.notifyproblem with a API call that,
in Standard theme, outputs the same HTML.
Also removes the .notifyproblem class from the heading,
as that might cause problems for themers who expect it to be
used consistently with the API.
Implements backup and restore for the new conditional availability
data. This includes:
* Backup and restore of new field.
* Restore updates IDs in conditions, as required.
* Restore converts availability data from legacy (Moodle 2.6) backups.
* Unit tests for all this.
The completion system has code which is supposed to prevent it
updating completion status while grades are being restored. This
code was a nasty hack and had not worked for some time. As a result
completion dates were restored incorrectly.
This commit implements a 'proper' way to find out if a restore is
currently running, replacing the previous hack.
Changes provided by Darko Miletic and Sam Chaffee.
* Fix problem with CC import not detecting a CC package. (Sam)
* Fixed Common Cartridge not importing FIB answers. (Sam)
* Fix to CC export so that short answer pattern matching question
in a quiz does not prevent the entire quiz from exporting. (Sam)
* Fix notice about missing index when there is no answer-specific
feedback in short answer question during CC export. (Sam)
* Fixed Japanese characters being incorrectly encoded (garbled)
on Common Cartridge import. (Sam)
* Changed import of CC discussions to create 'Standard General'
forums in Moodle. (Sam)
* Fix problem with question name being replaced with question
text on CC import of exported Moodle questions. (Sam)
* Fix CC 1.1 multiple choice question import having no correct
answers. (Sam)
* Fixed problem with multiple choice, multiple answers allowed
questions not exporting correct answers to CC. (Sam)
* Removed duplicate method. (Darko)
* Implemented fix that skips quiz export if it contains
non-exportable question. (Darko)
* Fixed: Common cartridge export is extremely slow when dealing
with lot of more than 200 files. (Darko)
* Added support for basic roles support in common cartridge. (Darko)
* Implemented folder resource export. (Darko)
* Minor fixes to adjust to the standard. (Darko)
* Added support for exporting simple fill in the blank
(shortanswer without wildcards in Moodle). (Darko)
* Added support for exporting essay question. (Darko)
* Added support for true/false export. (Darko)
* Added support for exporting multiple response questions,
added also category information into question metadata
during export (Darko)
* Added support for correctly importing multiple response
questions. (Darko)
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
Some columns needed to be renamed:
* quiz -> quizid
* question -> questionid
* grade -> maxmark
Then all the places that refer to those needed to be fixed.
While restoring course/activity, restore will blindly insert grade_item
sortorder. Which cause dulicate sortorder and lead to unpredicatble sorting
results.
Now we will call grade_item::fix_duplicate_sortorder() after restore is finished
to fix duplicate sortorder and order grade items to the closest order possible