Error while importing translated course

Error while importing translated course

by Jahanzaib Chishti -
Number of replies: 0

Hello Guys,

I am coming accross an issue when restoring a course into an existing course(or as a new course for that matter).

I have the following two mbz files--

  1.  A course file in Dutch
  2.  Another course file in English, which is identical to the above, except the content is translated into english.


What I have already done successfully--

I have imported the Dutch course mbz file successfully as a new course in my moodle system.

What I am trying to do--

I am trying to import the translated english course in the two scenarios below, both of which fail-- 

  1. Importing the file as a new course
  2. Importing the file into the existing Dutch course.

Upon trying the above, I receive the error shown in the screenshot.

It seems the error is coming from the following class--

https://github.com/moodle/moodle/blob/master/backup/moodle2/restore_qtype_plugin.class.php

Upon giving a closer look, it seems that the comparisons done inside process_question_answer() are giving me issues.

As you can see, in the other screenshot, i have dumped the answers received from the database, and the answer we received from the English file, the answer that we would like to import in, is different. The function is looking for exact matches between the text from the database and the translated text, which it fails at, because the translated content is differnet than the content in the database.

Note that this problem only occurs for questions. I have confirmed that by excluding the questions from the import via moodle ui, as well as tried to use a blank questions.xml file. When trying these, the course import works fine.

I have also tried importing translated course, without the questions.xml file, and then importing the questions seperately, using a previuolsy exported backup from the question bank. The questions do get imported into the question bank, however they do not automatically appear under the quiz/activities that they are supposed to appear under.

Kindly guide me as to how I can overcome this issue. Ultimate goal is to be able to import the translated course, as a new course, or into an existing course.


Regards

Jahanzaib

Attachment Screen Shot 2020-03-24 at 1.53.53 PM.jpg
Attachment Screen Shot 2020-03-24 at 2.46.29 PM.jpg
Average of ratings: -