Skip to content

Commit

Permalink
Fix for #73
Browse files Browse the repository at this point in the history
  • Loading branch information
ndunand committed Nov 27, 2024
1 parent c10c70b commit ecd39db
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backup/moodle2/restore_qtype_matrix_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function process_matrix($data): void {

// Todo: check import of version moodle1 data.

if ($this->is_question_created() || !$this->get_mappingid('qtype_matrix_matrix', $oldid)) {
if ($this->is_question_created()) {
$data->questionid = $this->get_new_parentid('question');
$newitemid = $DB->insert_record('qtype_matrix', $data);
$this->set_mapping('matrix', $oldid, $newitemid);
Expand Down Expand Up @@ -80,6 +80,10 @@ public function process_col($data): void {
$oldid = $data->id;

$newmatrixid = $this->get_new_parentid('matrix');
if (!$newmatrixid) {
return;
}

if ($this->is_question_created()) {
$data->matrixid = $newmatrixid;
$newitemid = $DB->insert_record('qtype_matrix_cols', $data);
Expand Down Expand Up @@ -111,6 +115,9 @@ public function process_row($data): void {
$oldid = $data->id;

$newmatrixid = $this->get_new_parentid('matrix');
if (!$newmatrixid) {
return;
}

if ($this->is_question_created()) {
$data->matrixid = $newmatrixid;
Expand Down

0 comments on commit ecd39db

Please sign in to comment.