mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
MDL-80650 quiz restore: restore of max marks review option from pre 4.2
This commit is contained in:
parent
580c009cac
commit
f4fc795642
@ -189,14 +189,6 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st
|
||||
($oldreview & QUIZ_OLD_CLOSED & QUIZ_OLD_SCORES ?
|
||||
display_options::AFTER_CLOSE : 0);
|
||||
|
||||
if (!isset($data->reviewmaxmarks)) {
|
||||
$data->reviewmaxmarks =
|
||||
display_options::DURING |
|
||||
display_options::IMMEDIATELY_AFTER |
|
||||
display_options::LATER_WHILE_OPEN |
|
||||
display_options::AFTER_CLOSE;
|
||||
}
|
||||
|
||||
$data->reviewmarks =
|
||||
display_options::DURING |
|
||||
($oldreview & QUIZ_OLD_IMMEDIATELY & QUIZ_OLD_SCORES ?
|
||||
@ -246,6 +238,15 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st
|
||||
display_options::AFTER_CLOSE : 0);
|
||||
}
|
||||
|
||||
// New setting in 4.3 needs to be set if not in tbe backup.
|
||||
if (!isset($data->reviewmaxmarks)) {
|
||||
$data->reviewmaxmarks =
|
||||
display_options::DURING |
|
||||
display_options::IMMEDIATELY_AFTER |
|
||||
display_options::LATER_WHILE_OPEN |
|
||||
display_options::AFTER_CLOSE;
|
||||
}
|
||||
|
||||
// The old popup column from from <= 2.1 need to be mapped to
|
||||
// the new browsersecurity. See MDL-29627.
|
||||
if (!isset($data->browsersecurity)) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
namespace mod_quiz;
|
||||
|
||||
use core_question\question_reference_manager;
|
||||
use mod_quiz\question\display_options;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
@ -238,6 +239,8 @@ class quiz_question_restore_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test pre 4.0 quiz restore for regular questions.
|
||||
*
|
||||
* Also, for efficiency, tests restore of the review options.
|
||||
*
|
||||
* @covers ::process_quiz_question_legacy_instance
|
||||
*/
|
||||
public function test_pre_4_quiz_restore_for_regular_questions() {
|
||||
@ -264,6 +267,12 @@ class quiz_question_restore_test extends \advanced_testcase {
|
||||
$quizobj = \mod_quiz\quiz_settings::create($quiz->instance);
|
||||
$structure = structure::create_for_quiz($quizobj);
|
||||
|
||||
// Verify the restored review options setting.
|
||||
$this->assertEquals(display_options::DURING |
|
||||
display_options::IMMEDIATELY_AFTER |
|
||||
display_options::LATER_WHILE_OPEN |
|
||||
display_options::AFTER_CLOSE, $quizobj->get_quiz()->reviewmaxmarks);
|
||||
|
||||
// Are the correct slots returned?
|
||||
$slots = $structure->get_slots();
|
||||
$this->assertCount(2, $slots);
|
||||
|
Loading…
x
Reference in New Issue
Block a user