Moodle
  1. Moodle
  2. MDL-30001

WEBCT Import does not work for 2,0

    Details

    • Testing Instructions:
      Hide

      Import the attached sample files using the Webct import format.

      • Verify no warning or error is displayed during import
      • Verify that the imported questions match he description given here
      • verify that he imported questions are editable and working.

      Import of the webct_essay_questions.txt

      This file contains one essay question. Import of essay questions is a new feature of the webct import format, it was no working in Moodle 1.9
      name: Question ES #1
      text: What are some of the benefits to using an open source application such as Moodle over a closed source application?
      Response format: HTML editor
      input box size: 15 lines
      attachments: no
      response template: empty
      informations for graders: 1. Moodle is Free, so no yearly costs
      2. You can customize Moodle to fit your needs
      3. You have the ability to fix bugs rather than waiting for a company that may / may not address them.

      Import of the the_4_questions.txt file

      note that there is some French language in these questions but understanding of French is not a requirement for the tester You don't need to know anything on Canada and Québec either
      As its name imply, this file contains 4 questions.

      name: Multiple choice
      type: multichoice
      text: Which of the following cities are NOT located in Québec province? Montréal, New York, Paris,Québec,Sherbrooke,
      One answer only
      Choice 1: New York Feedback: There is an another city; Paris
      Choice 2: Paris Feedback: There is an another city; New York
      Choice 3: New York, Paris Feedback: Good
      Choice 4: Sherbrooke Feedback: It is located in Québec province

      name: réponse courte, short answer
      type: shortanswer
      text: What is the most populated city in Québec province? Montréal, Québec, Sherbrooke
      case sensitivity: No case is unimportant
      Answer 1: Montréal Grade: 100%
      Answer 2: Québec Grade: 50%
      Answer 3: Sherbrooke Grade 10%

      name: correspondance (matching)
      type: match
      text: Match the information
      Question 1: Québec province capital Answer: Québec
      Question 2: Québec province most populated city Answer: Monrtéal
      Question 3: Québec province second populated city Answer: Laval

      name: calculated\:surface d'un carré (there is a small glitch here: surely the backslash should be removed, I will create a separate isssue to take care of the problem afer discussion with Pierre Pichet when he come back from holidays, so don't fail the issue for that)
      type: calculated
      text: Quelle est la surface en m2 d'un carré ( square) ayant un côté (side) de {l}m ?
      Answer 1 formula = {l}*{l} Grade: 100%
      Tolerance: 0 Type: relative
      Answer display: 1 Format: decimal
      Wild card(l) will use the same exising private daaset as before
      Range of values Minimum: 10 Maximum: 100 Decimal place: 0
      There are 10 existing sets
      1:51
      2:32
      3:57
      4:94
      5:38
      6:54
      7:87
      8:90
      9:78
      10:39
      You need to choose 10 in the "set(s) of wild card(s) values" dropdown menu and click on the Display button to see them all.

      Import of the WEB-CTv3.zip file

      This is the same sample that the webct_essay_questions.txt but as a zip archive to verify that the feature to import zip archives (new in this version it was no available in Moodle 1.9) is working. Unfortunately I don't have any sample file with images
      You should get the same Question ES #1 essay question

      Final note

      I am less confident in this import format than on other ones I have fixed because I have not many sample files, but as Tim said in the comments, this is broken on all stables branches since Moodle 2.0 so let's integrate something working and fix bugs when they are discovered

      Show
      Import the attached sample files using the Webct import format. Verify no warning or error is displayed during import Verify that the imported questions match he description given here verify that he imported questions are editable and working. Import of the webct_essay_questions.txt This file contains one essay question. Import of essay questions is a new feature of the webct import format, it was no working in Moodle 1.9 name: Question ES #1 text: What are some of the benefits to using an open source application such as Moodle over a closed source application? Response format: HTML editor input box size: 15 lines attachments: no response template: empty informations for graders: 1. Moodle is Free, so no yearly costs 2. You can customize Moodle to fit your needs 3. You have the ability to fix bugs rather than waiting for a company that may / may not address them. Import of the the_4_questions.txt file note that there is some French language in these questions but understanding of French is not a requirement for the tester You don't need to know anything on Canada and Québec either As its name imply, this file contains 4 questions. name: Multiple choice type: multichoice text: Which of the following cities are NOT located in Québec province? Montréal, New York, Paris,Québec,Sherbrooke, One answer only Choice 1: New York Feedback: There is an another city; Paris Choice 2: Paris Feedback: There is an another city; New York Choice 3: New York, Paris Feedback: Good Choice 4: Sherbrooke Feedback: It is located in Québec province name: réponse courte, short answer type: shortanswer text: What is the most populated city in Québec province? Montréal, Québec, Sherbrooke case sensitivity: No case is unimportant Answer 1: Montréal Grade: 100% Answer 2: Québec Grade: 50% Answer 3: Sherbrooke Grade 10% name: correspondance (matching) type: match text: Match the information Question 1: Québec province capital Answer: Québec Question 2: Québec province most populated city Answer: Monrtéal Question 3: Québec province second populated city Answer: Laval name: calculated\:surface d'un carré (there is a small glitch here: surely the backslash should be removed, I will create a separate isssue to take care of the problem afer discussion with Pierre Pichet when he come back from holidays, so don't fail the issue for that) type: calculated text: Quelle est la surface en m2 d'un carré ( square) ayant un côté (side) de {l}m ? Answer 1 formula = {l}*{l} Grade: 100% Tolerance: 0 Type: relative Answer display: 1 Format: decimal Wild card(l) will use the same exising private daaset as before Range of values Minimum: 10 Maximum: 100 Decimal place: 0 There are 10 existing sets 1:51 2:32 3:57 4:94 5:38 6:54 7:87 8:90 9:78 10:39 You need to choose 10 in the "set(s) of wild card(s) values" dropdown menu and click on the Display button to see them all. Import of the WEB-CTv3.zip file This is the same sample that the webct_essay_questions.txt but as a zip archive to verify that the feature to import zip archives (new in this version it was no available in Moodle 1.9) is working. Unfortunately I don't have any sample file with images You should get the same Question ES #1 essay question Final note I am less confident in this import format than on other ones I have fixed because I have not many sample files, but as Tim said in the comments, this is broken on all stables branches since Moodle 2.0 so let's integrate something working and fix bugs when they are discovered
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull 2.4 Branch:
    • Pull 2.5 Branch:
    • Pull Master Branch:
    • Rank:
      19545

      Description

      The WEBCT import code needs to be updated to 2,0 and 2,1 question structure

      1. the_4_questions.txt
        2 kB
        Pierre Pichet
      2. webct_essay_questions.txt
        0.4 kB
        Jean-Michel Vedrine

        Issue Links

          Activity

          Hide
          Pierre Pichet added a comment -

          I know quite well the WEBCT code as I was part of the team when UQAM migrate from WEBCT to Moodle.

          the related quiz forum issue is
          http://moodle.org/mod/forum/discuss.php?d=189220

          Show
          Pierre Pichet added a comment - I know quite well the WEBCT code as I was part of the team when UQAM migrate from WEBCT to Moodle. the related quiz forum issue is http://moodle.org/mod/forum/discuss.php?d=189220
          Hide
          Pierre Pichet added a comment - - edited

          A solution has been found by only correcting the WebCT/format.php.
          Putting aside for more testing and code checking.
          This old file generate more than 100 errors using Tim code checker...

          Show
          Pierre Pichet added a comment - - edited A solution has been found by only correcting the WebCT/format.php. Putting aside for more testing and code checking. This old file generate more than 100 errors using Tim code checker...
          Hide
          Pierre Pichet added a comment -

          file used to test.

          Show
          Pierre Pichet added a comment - file used to test.
          Hide
          Pierre Pichet added a comment -

          The samples .zip files available in the forum discussion contain images which are not handled in the old code.
          I have to look to other zip import packages(i.e. restore) to know how to handle this in the new file API.

          I have recoded the migrating code including files or images from WebCT to moodle 1,6 some years ago so this should help me.

          Show
          Pierre Pichet added a comment - The samples .zip files available in the forum discussion contain images which are not handled in the old code. I have to look to other zip import packages(i.e. restore) to know how to handle this in the new file API. I have recoded the migrating code including files or images from WebCT to moodle 1,6 some years ago so this should help me.
          Hide
          Jean-Michel Vedrine added a comment -

          Hello Pierre,
          I don't know webct format at all, but maybe you can look at what I have done to add images support to Examview and Blackboard_six format for Moodle 2.1 ? I don't know if it will really help you but hopefully you can adapt this for Webct ?
          You can download my version for blackboard 6 in my message from today in that forum thread : http://moodle.org/mod/forum/discuss.php?d=148877#p830850
          You need to look at the 3 functions process_img_tags, recode_urls, and process_text
          and you will need to correctly fill filebase with the base path to the images.

          Show
          Jean-Michel Vedrine added a comment - Hello Pierre, I don't know webct format at all, but maybe you can look at what I have done to add images support to Examview and Blackboard_six format for Moodle 2.1 ? I don't know if it will really help you but hopefully you can adapt this for Webct ? You can download my version for blackboard 6 in my message from today in that forum thread : http://moodle.org/mod/forum/discuss.php?d=148877#p830850 You need to look at the 3 functions process_img_tags, recode_urls, and process_text and you will need to correctly fill filebase with the base path to the images.
          Hide
          Pierre Pichet added a comment -

          Thanks for the cue.
          I have hope that somebody solve the blackboard case
          My other source will have been the backup-restore code.
          I give feedback after doing my homeworks as teacher

          Show
          Pierre Pichet added a comment - Thanks for the cue. I have hope that somebody solve the blackboard case My other source will have been the backup-restore code. I give feedback after doing my homeworks as teacher
          Hide
          Tim Hunt added a comment -

          Chris, just adding partner tags to this is unlikely to have any effect. Does Moodlerooms have any developer resource to devote to this.

          Fixing import/export formats is relatively easy, if boring, providing you have a way to generate test data, and I have no way to generate WebCT file. Also, the OU has no interest in WebCT format, so I am unlikely ever to spend significant time of this.

          I am able to offer generic advice about how qformats work, to help anyone who is able to try to fix this.

          Show
          Tim Hunt added a comment - Chris, just adding partner tags to this is unlikely to have any effect. Does Moodlerooms have any developer resource to devote to this. Fixing import/export formats is relatively easy, if boring, providing you have a way to generate test data, and I have no way to generate WebCT file. Also, the OU has no interest in WebCT format, so I am unlikely ever to spend significant time of this. I am able to offer generic advice about how qformats work, to help anyone who is able to try to fix this.
          Hide
          Chris Follin added a comment -

          Tim, we add tags to all issues affecting us or our clients. At the moment, we do not have developer resources available to devote to this issue.

          Show
          Chris Follin added a comment - Tim, we add tags to all issues affecting us or our clients. At the moment, we do not have developer resources available to devote to this issue.
          Hide
          Pierre Pichet added a comment -

          Sorry that my almost full time fall session teacher load does not allow we to go ahead on this problem (and my "regular" moodle workload.)

          The next months appear more Moodle friendly

          In the mean time, I just expect that the file handling will be improved as planned
          http://docs.moodle.org/dev/Improved_support_for_external_File_content

          Show
          Pierre Pichet added a comment - Sorry that my almost full time fall session teacher load does not allow we to go ahead on this problem (and my "regular" moodle workload.) The next months appear more Moodle friendly In the mean time, I just expect that the file handling will be improved as planned http://docs.moodle.org/dev/Improved_support_for_external_File_content
          Hide
          Pierre Pichet added a comment -

          It seems I can solved WebCT import with old style .txt file (more tests necessary)
          see http://moodle.org/mod/forum/discuss.php?d=189220

          I suggest to put here the necessary gits and create another bug for .zip files that could contain images.
          A distinct choice should then be offered in the import page.

          Show
          Pierre Pichet added a comment - It seems I can solved WebCT import with old style .txt file (more tests necessary) see http://moodle.org/mod/forum/discuss.php?d=189220 I suggest to put here the necessary gits and create another bug for .zip files that could contain images. A distinct choice should then be offered in the import page.
          Hide
          Pierre Pichet added a comment - - edited

          The .zip file contains a directory (say vectors)in which there is the questiontext ( vectors.txt) similar to the noimages one and the files in an images directory.
          a typical question being

          1. Start of question:Question 002
            :TYPE:MC:1:0:A
            :TITLE:ppa6g 3.2-7
            :QUESTION:H
            Two vectors <b><img align="bottom" src="vectors/imagefiles/f1q2g1.jpg"/></b> and <b><img align="bottom" src="vectors/imagefiles/f1q2g2.jpg"/></b> have components (0, 1) and (-1, 3), respectively. What is magnitude of the sum of these two vectors?
            :LAYOUT:horizontal
            :ANSWERORDER:randomized
            :INDICES:letters
            :ANSWER1:100:H
            4.1
            :ANSWER2:0:H
            3.9
            :ANSWER3:0:H
            3.2
            :ANSWER4:0:H
            2.8

          So the "vectors/imagefiles/" needs to be changed to the "@@PLUGINFILE@@"

          So I will try using part of blackboard code and the webct.txt in a new import format.

          Show
          Pierre Pichet added a comment - - edited The .zip file contains a directory (say vectors)in which there is the questiontext ( vectors.txt) similar to the noimages one and the files in an images directory. a typical question being Start of question:Question 002 :TYPE:MC:1:0:A :TITLE:ppa6g 3.2-7 :QUESTION:H Two vectors <b><img align="bottom" src="vectors/imagefiles/f1q2g1.jpg"/></b> and <b><img align="bottom" src="vectors/imagefiles/f1q2g2.jpg"/></b> have components (0, 1) and (-1, 3), respectively. What is magnitude of the sum of these two vectors? :LAYOUT:horizontal :ANSWERORDER:randomized :INDICES:letters :ANSWER1:100:H 4.1 :ANSWER2:0:H 3.9 :ANSWER3:0:H 3.2 :ANSWER4:0:H 2.8 So the "vectors/imagefiles/" needs to be changed to the "@@PLUGINFILE@@" So I will try using part of blackboard code and the webct.txt in a new import format.
          Hide
          Pierre Pichet added a comment -

          I can import simple txt files with the new question 2,2 parameters.
          I can also handle the similar .zip files which has an images directory using some of the functions that Jean-Michel developped for blackboard (MDL-25492).
          Should we put these functions somewhere else so that they be used without copying them ?

          The .zip file handling ask for copy to a temp directory.
          The function designed to clean these directories which have a unique identifier just return without doing anything.
          there is a TODO comment...

          What are the requirements to build a good WEBCT solution that can be updated to master and other versions?

          Show
          Pierre Pichet added a comment - I can import simple txt files with the new question 2,2 parameters. I can also handle the similar .zip files which has an images directory using some of the functions that Jean-Michel developped for blackboard ( MDL-25492 ). Should we put these functions somewhere else so that they be used without copying them ? The .zip file handling ask for copy to a temp directory. The function designed to clean these directories which have a unique identifier just return without doing anything. there is a TODO comment... What are the requirements to build a good WEBCT solution that can be updated to master and other versions?
          Hide
          Jean-Michel Vedrine added a comment -

          I agree with Pierre :

          • some functions are usefull for all import formats working on zip files : create the temporary dir, reading images files from a directory, rewrite img urls, delete temporary files. It would be good to avoid code duplication. Then at least 3 formats could use the same methods : webct, blackboard_six, and the new examview_bb6.
            We must also resolve the problem that all these formats fail to delete the temporary files at the end of the import process. Some Moodle site should have tons of these temporary files pilling in the temp directory because this is broken since many years !
          Show
          Jean-Michel Vedrine added a comment - I agree with Pierre : some functions are usefull for all import formats working on zip files : create the temporary dir, reading images files from a directory, rewrite img urls, delete temporary files. It would be good to avoid code duplication. Then at least 3 formats could use the same methods : webct, blackboard_six, and the new examview_bb6. We must also resolve the problem that all these formats fail to delete the temporary files at the end of the import process. Some Moodle site should have tons of these temporary files pilling in the temp directory because this is broken since many years !
          Hide
          Tim Hunt added a comment -

          Sorry, I missed this question.

          If there are generally useful functions for handling zip files that can be used by several import and export formats, then there are two options for where to put them.

          1. You can put them in the qformat_default base class that is defined in question/format.php.

          2. You could make a new file question/format/ziputils.php, that defines a class called something like qformat_zip_utils, and put the helper methods there. (It might be best to make them static methods.

          Either option is OK. I have a slight preference for option 2., I think.

          Show
          Tim Hunt added a comment - Sorry, I missed this question. If there are generally useful functions for handling zip files that can be used by several import and export formats, then there are two options for where to put them. 1. You can put them in the qformat_default base class that is defined in question/format.php. 2. You could make a new file question/format/ziputils.php, that defines a class called something like qformat_zip_utils, and put the helper methods there. (It might be best to make them static methods. Either option is OK. I have a slight preference for option 2., I think.
          Hide
          Pierre Pichet added a comment -

          I think that we should have the objective to create common code qformat_zip_utils.
          However until everything is fully tested individually, we could use independently
          specific functions for each formats keeping in mind their future generalization.

          For each format there is a lot of testing (simpletest ?) for each individual format.
          as an example in WEBCT there is a plain text file source or a .zip with a specific format that is not the blackboard one.

          One common problem is how to clean the files created in the process ?

          Unless Jean-Michle has already figure some of the possible common functions so that they can included in the various formats.

          Given your speciality, Jean-michel and or Tim, you are designated to build these functions

          Show
          Pierre Pichet added a comment - I think that we should have the objective to create common code qformat_zip_utils. However until everything is fully tested individually, we could use independently specific functions for each formats keeping in mind their future generalization. For each format there is a lot of testing (simpletest ?) for each individual format. as an example in WEBCT there is a plain text file source or a .zip with a specific format that is not the blackboard one. One common problem is how to clean the files created in the process ? Unless Jean-Michle has already figure some of the possible common functions so that they can included in the various formats. Given your speciality, Jean-michel and or Tim, you are designated to build these functions
          Hide
          Tim Hunt added a comment -

          It is fine to create these functions in one place, and get them working, and then to move them later, when they need to be shared elsewhere.

          Show
          Tim Hunt added a comment - It is fine to create these functions in one place, and get them working, and then to move them later, when they need to be shared elsewhere.
          Hide
          Pierre Pichet added a comment -

          I have a working version that can handle questions exported from WEBCT with and without figures.
          There is a third more complex format that I cannot handle.
          However in the import process the files are stored in moodledata in a unique directory before being stored in a regular way.
          This delete function for this directory does not do anything in the actual version.
          unique directory
          I have put the work in progress code on github
          https://github.com/ppichet/moodle/compare/MDL-30001
          the problematic function is
          public function clean_temp_dir($dir='') {

          From MDL-25492 Tim have set this comment
          "Jean-Michel, Please remind me about the $CFG->dataroot."/temp" when the time comes."

          So ...

          There should be a function in actual moodle code to handle the delete of a directory and all his content...

          Show
          Pierre Pichet added a comment - I have a working version that can handle questions exported from WEBCT with and without figures. There is a third more complex format that I cannot handle. However in the import process the files are stored in moodledata in a unique directory before being stored in a regular way. This delete function for this directory does not do anything in the actual version. unique directory I have put the work in progress code on github https://github.com/ppichet/moodle/compare/MDL-30001 the problematic function is public function clean_temp_dir($dir='') { From MDL-25492 Tim have set this comment "Jean-Michel, Please remind me about the $CFG->dataroot."/temp" when the time comes." So ... There should be a function in actual moodle code to handle the delete of a directory and all his content...
          Hide
          Jean-Michel Vedrine added a comment -

          Hello Pierre,
          About the problem of temporary files not been deleted at the end of questions import here is my code for Blackboard and Examview foarmats

          public function clean_temp_dir($path='') {
          if ($path == '')

          { $path = $this->temp_dir; }

          $dir = new DirectoryIterator($path);
          foreach ($dir as $fileinfo) {
          if ($fileinfo->isFile() || $fileinfo->isLink())

          { unlink($fileinfo->getPathName()); }

          elseif (!$fileinfo->isDot() && $fileinfo->isDir())

          { $this->removeDirectory($fileinfo->getPathName()); }

          }
          rmdir($path);
          }
          As you see it's rather short. Directory Iterators are a new feature of PHP 5 (so we can not use them with Moodle 1.9.x but we can use them safely with Moodle 2.x) and I find they are very usefull to traverse a directory tree.

          Tim's comment "Jean-Michel, Please remind me about the $CFG->dataroot."/temp" when the time comes." was because depending on Moodle versions you need to use $CFG->dataroot."/temp" for older 2.X versions and $CFG->tempdir for more recent Moodle versions. So you and me we will have to make several branchs of ours imports formats to deal with this problem. I don't remember when $CFG->tempdir was first introduced.

          Show
          Jean-Michel Vedrine added a comment - Hello Pierre, About the problem of temporary files not been deleted at the end of questions import here is my code for Blackboard and Examview foarmats public function clean_temp_dir($path='') { if ($path == '') { $path = $this->temp_dir; } $dir = new DirectoryIterator($path); foreach ($dir as $fileinfo) { if ($fileinfo->isFile() || $fileinfo->isLink()) { unlink($fileinfo->getPathName()); } elseif (!$fileinfo->isDot() && $fileinfo->isDir()) { $this->removeDirectory($fileinfo->getPathName()); } } rmdir($path); } As you see it's rather short. Directory Iterators are a new feature of PHP 5 (so we can not use them with Moodle 1.9.x but we can use them safely with Moodle 2.x) and I find they are very usefull to traverse a directory tree. Tim's comment "Jean-Michel, Please remind me about the $CFG->dataroot."/temp" when the time comes." was because depending on Moodle versions you need to use $CFG->dataroot."/temp" for older 2.X versions and $CFG->tempdir for more recent Moodle versions. So you and me we will have to make several branchs of ours imports formats to deal with this problem. I don't remember when $CFG->tempdir was first introduced.
          Hide
          Jean-Michel Vedrine added a comment -

          Please Pierre note my remark above is now irrelevant, look at the blackboard_six import format code to see how to deal with temporary files and directories with Moodle API functions.

          Show
          Jean-Michel Vedrine added a comment - Please Pierre note my remark above is now irrelevant, look at the blackboard_six import format code to see how to deal with temporary files and directories with Moodle API functions.
          Hide
          Pierre Pichet added a comment -

          The most important issue for me this autumn is outside moodle code but inside moodle uqam; i.e. to fix my courses
          for secondary school teachers to the new secondary school program.
          So feel free to work on this using your knowledge build the hard way on those import from outside moodle universe.

          Show
          Pierre Pichet added a comment - The most important issue for me this autumn is outside moodle code but inside moodle uqam; i.e. to fix my courses for secondary school teachers to the new secondary school program. So feel free to work on this using your knowledge build the hard way on those import from outside moodle universe.
          Hide
          Jean-Michel Vedrine added a comment -

          Hello Pierre,
          I understand !
          I will try to work on this.
          I see you have a MDL-30001 branch on your github account. Is it the last state of your work (I didn't had a look at it, just saw it existed) ?
          Also I would be interested in all webct questions' files that you can provide.

          Show
          Jean-Michel Vedrine added a comment - Hello Pierre, I understand ! I will try to work on this. I see you have a MDL-30001 branch on your github account. Is it the last state of your work (I didn't had a look at it, just saw it existed) ? Also I would be interested in all webct questions' files that you can provide.
          Hide
          Jean-Michel Vedrine added a comment -

          I merged Pierre's changes with current master. I also fixed all issues found by codechecker (not sure it was a wise move as it completely hides the changes).
          This is of course a work in progress so I don't ask to peer review it for now but it already seems to be able to import .txt and .zip files without images.
          Feel free to comment and tell me what need to be done.
          To be continued...

          Show
          Jean-Michel Vedrine added a comment - I merged Pierre's changes with current master. I also fixed all issues found by codechecker (not sure it was a wise move as it completely hides the changes). This is of course a work in progress so I don't ask to peer review it for now but it already seems to be able to import .txt and .zip files without images. Feel free to comment and tell me what need to be done. To be continued...
          Hide
          Jean-Michel Vedrine added a comment -

          The import of images in zip files is now working.
          But to avoid unnecessary work, I have based this on a work I never submitted : a better solution to MDL-35147 so that question->questiontext and question->generalfeedback are always strings and never arrays.
          Short explanation: when I fixed MDL-25492, to make the blackboard_six import format able to import images in questiontext and generalfeedback I changed question->questiontext and question->generalfeedback to be arrays.
          As Eloy pointed out in MDL-35147 comments:
          "But I don't think it's the correct solution. IMO the lesson importer should be receiving constant structures. And this seems a nasty exception. And worse, I don't know which impact can have within qbanks importer, or how the hell that importer is able to handle both strings and arrays."
          So I looked at finding another solution, I created some code but never had time to submit it !

          So I think the correct way to manage this is to create another tracker issue as a follow up of MDL-35147 and submit my new idea to manage images import in questiontext and generalfeedback. Once this code is accepted by Tim (of course if he agrees ! ), most probably after he return from his holidays, we can submit it for integration.
          Then once this is closed, I can resume my work on the present issue MDL-30001

          Show
          Jean-Michel Vedrine added a comment - The import of images in zip files is now working. But to avoid unnecessary work, I have based this on a work I never submitted : a better solution to MDL-35147 so that question->questiontext and question->generalfeedback are always strings and never arrays. Short explanation: when I fixed MDL-25492 , to make the blackboard_six import format able to import images in questiontext and generalfeedback I changed question->questiontext and question->generalfeedback to be arrays. As Eloy pointed out in MDL-35147 comments: "But I don't think it's the correct solution. IMO the lesson importer should be receiving constant structures. And this seems a nasty exception. And worse, I don't know which impact can have within qbanks importer, or how the hell that importer is able to handle both strings and arrays." So I looked at finding another solution, I created some code but never had time to submit it ! So I think the correct way to manage this is to create another tracker issue as a follow up of MDL-35147 and submit my new idea to manage images import in questiontext and generalfeedback. Once this code is accepted by Tim (of course if he agrees ! ), most probably after he return from his holidays, we can submit it for integration. Then once this is closed, I can resume my work on the present issue MDL-30001
          Hide
          Jean-Michel Vedrine added a comment -

          I have created MDL-36243 and I think MDL-36243 needs to be closed first before we can look at finishing MDL-30001

          Show
          Jean-Michel Vedrine added a comment - I have created MDL-36243 and I think MDL-36243 needs to be closed first before we can look at finishing MDL-30001
          Hide
          Jean-Michel Vedrine added a comment -

          Bonjour Pierre,
          Peux-tu m'aider à comprendre le commentaire qui est dans question/format/webct/format.php
          // This tempgeneralfeedback allows the code to work with versions from 1.6 to 1.9.
          // When question->generalfeedback is undefined, the webct feedback is added to each answer feedback.

          Car je ne comprend pas pourquoi cela a été codé comme cela. Il me semble que maintenant on peut simplement se passer de tempgeneralfeedback et importer dans generalfeedback dans tous les cas mais je voudrais en être sûr avant de changer le code.

          Show
          Jean-Michel Vedrine added a comment - Bonjour Pierre, Peux-tu m'aider à comprendre le commentaire qui est dans question/format/webct/format.php // This tempgeneralfeedback allows the code to work with versions from 1.6 to 1.9. // When question->generalfeedback is undefined, the webct feedback is added to each answer feedback. Car je ne comprend pas pourquoi cela a été codé comme cela. Il me semble que maintenant on peut simplement se passer de tempgeneralfeedback et importer dans generalfeedback dans tous les cas mais je voudrais en être sûr avant de changer le code.
          Hide
          Pierre Pichet added a comment -

          As far as I can remember when looking back to the history, the addition of these lines were done when I added calculated questiontype import to moodle 1,6-1.9 versions with just one set of code lines.
          As we are now handling versions differently, you can rewrite the code differently for 2.3 as you propose to do.

          Show
          Pierre Pichet added a comment - As far as I can remember when looking back to the history, the addition of these lines were done when I added calculated questiontype import to moodle 1,6-1.9 versions with just one set of code lines. As we are now handling versions differently, you can rewrite the code differently for 2.3 as you propose to do.
          Hide
          Jean-Michel Vedrine added a comment -

          MDL-36243 is now integrated and tested so will hopefully be part of this week release.
          So I can look at finishing this issue. I think we need some unit tests and some sample files.

          Show
          Jean-Michel Vedrine added a comment - MDL-36243 is now integrated and tested so will hopefully be part of this week release. So I can look at finishing this issue. I think we need some unit tests and some sample files.
          Hide
          Tim Hunt added a comment -

          That would be great

          Show
          Tim Hunt added a comment - That would be great
          Hide
          Jean-Michel Vedrine added a comment -

          Hello Tim,
          I think this is now ready for a first peer review (of course when you find some time)

          • as all the cleaning is now integrated thanks to MDL-36243, the changes for this issues are a lot clearer and easier to review
          • all phpunit tests are now passing which seems to indicate that imported data is what we expect
          • the sample file the_4_questions.txt attached to this issue is also imported correctly including the calculated question
          • codechecker report no error or warning

          Left to do:

          • I would be more confident if we had a zip sample file including some images. Pierre surely has such files, but unfortunately he is on holidays (well no unfortunately for him I guess )
          • I have not sorted the tempgeneralfeedback thing. Well it works as it is, but it would be better to clean the code
          • once I have some more sample files I need to write testing instructions
          Show
          Jean-Michel Vedrine added a comment - Hello Tim, I think this is now ready for a first peer review (of course when you find some time) as all the cleaning is now integrated thanks to MDL-36243 , the changes for this issues are a lot clearer and easier to review all phpunit tests are now passing which seems to indicate that imported data is what we expect the sample file the_4_questions.txt attached to this issue is also imported correctly including the calculated question codechecker report no error or warning Left to do: I would be more confident if we had a zip sample file including some images. Pierre surely has such files, but unfortunately he is on holidays (well no unfortunately for him I guess ) I have not sorted the tempgeneralfeedback thing. Well it works as it is, but it would be better to clean the code once I have some more sample files I need to write testing instructions
          Hide
          Jean-Michel Vedrine added a comment -

          Attaching here a zip sample file containing an essay question. It was previously attached to subtask MDL-32086 but better to have all files here for testing.
          Unfortunately this question don't contain any image

          Show
          Jean-Michel Vedrine added a comment - Attaching here a zip sample file containing an essay question. It was previously attached to subtask MDL-32086 but better to have all files here for testing. Unfortunately this question don't contain any image
          Hide
          Tim Hunt added a comment -

          Looking quite good overall. Some issues:

          0. We need testing instructions on this issue.

          1. Missing blank line: https://github.com/jmvedrine/moodle/compare/master...MDL-30001#L1R170

          2. Some = signs are missing the space either before or after.

          3. I don't know what TODO.txt is for. None of the other qtypes have that. I think it should go.

          4. I assume you have tested this. I have not.

          Show
          Tim Hunt added a comment - Looking quite good overall. Some issues: 0. We need testing instructions on this issue. 1. Missing blank line: https://github.com/jmvedrine/moodle/compare/master...MDL-30001#L1R170 2. Some = signs are missing the space either before or after. 3. I don't know what TODO.txt is for. None of the other qtypes have that. I think it should go. 4. I assume you have tested this. I have not.
          Hide
          Jean-Michel Vedrine added a comment -

          Hello,

          1. I am waiting to have all the needed sample files to write testing instructions
          2. Fixed
          3. Why isn't the codechecker catching this ? Fixed (I think) but not really sure I caught all of them
          4. Done. I don't really understand the content of this TODO.txt file.
          5. Yep and each time I make a "last minute change" I test again

          What I am really missing now is a zip sample file with images

          Show
          Jean-Michel Vedrine added a comment - Hello, I am waiting to have all the needed sample files to write testing instructions Fixed Why isn't the codechecker catching this ? Fixed (I think) but not really sure I caught all of them Done. I don't really understand the content of this TODO.txt file. Yep and each time I make a "last minute change" I test again What I am really missing now is a zip sample file with images
          Hide
          Jean-Michel Vedrine added a comment -

          Unfortunately as this is built on MDL-39404, it will be difficult to backport, so I have only done a master branch.

          Show
          Jean-Michel Vedrine added a comment - Unfortunately as this is built on MDL-39404 , it will be difficult to backport, so I have only done a master branch.
          Hide
          Tim Hunt added a comment -

          Well, the version of webct import on the stable branches is completely broken and useless (if I understand correctly). Therefore, it would be a really good idea to back-port your changes, even if they have small regressions.

          I suggest that, rather than trying to back-port using git cherry-pick, you just copy the format/webct folder from master into the stable branches, and commit it. As far as I can see, that will work, right?

          Show
          Tim Hunt added a comment - Well, the version of webct import on the stable branches is completely broken and useless (if I understand correctly). Therefore, it would be a really good idea to back-port your changes, even if they have small regressions. I suggest that, rather than trying to back-port using git cherry-pick, you just copy the format/webct folder from master into the stable branches, and commit it. As far as I can see, that will work, right?
          Hide
          Pierre Pichet added a comment -

          Thanks Jean-Michel to work on this.
          My Ipad ( and my matrimonial status) allows me to only read tracker and moodle quiz but not github... on holidays.
          I don't anymore have access to a working WEBCT to generate tests files.

          Show
          Pierre Pichet added a comment - Thanks Jean-Michel to work on this. My Ipad ( and my matrimonial status) allows me to only read tracker and moodle quiz but not github... on holidays. I don't anymore have access to a working WEBCT to generate tests files.
          Hide
          Tim Hunt added a comment -

          Just to be clear, I won think that the only things required before this is submitted for integration are:

          1. Write some testing instructions.
          2. 'back-port' or at least copy the code to stable branches.

          Given how broken this is, I think we should do that soon, even if we then need follow-up issues to fix minor remaining bugs.

          Show
          Tim Hunt added a comment - Just to be clear, I won think that the only things required before this is submitted for integration are: 1. Write some testing instructions. 2. 'back-port' or at least copy the code to stable branches. Given how broken this is, I think we should do that soon, even if we then need follow-up issues to fix minor remaining bugs.
          Hide
          Jean-Michel Vedrine added a comment -

          attaching a file with an essay question

          Show
          Jean-Michel Vedrine added a comment - attaching a file with an essay question
          Hide
          Jean-Michel Vedrine added a comment -

          I think testing instructions are OK now, I will "brute force backport" on sable branchs.

          Show
          Jean-Michel Vedrine added a comment - I think testing instructions are OK now, I will "brute force backport" on sable branchs.
          Hide
          Jean-Michel Vedrine added a comment -

          Stable branchs are done now
          Only differences are:

          • the 'paragraphquestion' string is not suppressed on stable branchs (I think maybe I should have an AMOS script for that on master commit but I don't remember the syntax ?)
          • versions and versions requiremens are diffrents
          • responsetemplate is no used on 2.4 when importing essay questions

          Maybe there are other things I overlooked ? We will see.

          Show
          Jean-Michel Vedrine added a comment - Stable branchs are done now Only differences are: the 'paragraphquestion' string is not suppressed on stable branchs (I think maybe I should have an AMOS script for that on master commit but I don't remember the syntax ?) versions and versions requiremens are diffrents responsetemplate is no used on 2.4 when importing essay questions Maybe there are other things I overlooked ? We will see.
          Hide
          Jean-Michel Vedrine added a comment -

          If you don't see anything missing, this can be send to integration

          Show
          Jean-Michel Vedrine added a comment - If you don't see anything missing, this can be send to integration
          Hide
          Tim Hunt added a comment -

          Can we close the sub-tasks now?

          Show
          Tim Hunt added a comment - Can we close the sub-tasks now?
          Hide
          Jean-Michel Vedrine added a comment -

          I surely should wait this is integrated, but this is quite a celebration of an adventure started in 2011: this is the last broken import format to be fixed !!

          Show
          Jean-Michel Vedrine added a comment - I surely should wait this is integrated, but this is quite a celebration of an adventure started in 2011: this is the last broken import format to be fixed !!
          Hide
          Tim Hunt added a comment -

          Thanks Jean-Michel. Submitting for integration now.

          Show
          Tim Hunt added a comment - Thanks Jean-Michel. Submitting for integration now.
          Hide
          Jean-Michel Vedrine added a comment -

          I have closed the 2 sub-tasks

          Show
          Jean-Michel Vedrine added a comment - I have closed the 2 sub-tasks
          Hide
          Dan Poltawski added a comment -

          I've added docs_required here, mostly because I suppose the fact its fixed needs publicising.

          Show
          Dan Poltawski added a comment - I've added docs_required here, mostly because I suppose the fact its fixed needs publicising.
          Hide
          Dan Poltawski added a comment -

          Integrated to master, 25 and 24 - thanks Jean-Michel

          Show
          Dan Poltawski added a comment - Integrated to master, 25 and 24 - thanks Jean-Michel
          Hide
          Andrew Davis added a comment -

          This appears to be working as described. Passing. Well done

          Show
          Andrew Davis added a comment - This appears to be working as described. Passing. Well done
          Hide
          Jean-Michel Vedrine added a comment -

          Thanks Andrew,
          This was the last one. All core questions import formats are now working

          Show
          Jean-Michel Vedrine added a comment - Thanks Andrew, This was the last one. All core questions import formats are now working
          Hide
          Dan Poltawski added a comment -

          Cảm ơn!

          Your changes have now been merged upstream in git and will be available on the Moodle download sites shortly!

          Một hai ba, yo

          Show
          Dan Poltawski added a comment - Cảm ơn! Your changes have now been merged upstream in git and will be available on the Moodle download sites shortly! Một hai ba, yo
          Hide
          Mary Cooch added a comment - - edited

          I am going through the docs_required labels housekeeping and noticed this label is still displayed and the relevant page (I think) is http://docs.moodle.org/26/en/WebCT_format However, I have no knowledge of WebCT import but I do think the page is out of date at the very least because it does not mention essay questions being imported, and has not been updated since 2010. Would it suffice just to say that it is possible to import all WebCT question types? If Jean-Michel Vedrinewould like to offer a suggestion, I would be grateful.

          Show
          Mary Cooch added a comment - - edited I am going through the docs_required labels housekeeping and noticed this label is still displayed and the relevant page (I think ) is http://docs.moodle.org/26/en/WebCT_format However, I have no knowledge of WebCT import but I do think the page is out of date at the very least because it does not mention essay questions being imported, and has not been updated since 2010. Would it suffice just to say that it is possible to import all WebCT question types? If Jean-Michel Vedrine would like to offer a suggestion, I would be grateful.
          Hide
          Jean-Michel Vedrine added a comment -

          Hello Mary,
          I think the main thing is to edit the page http://docs.moodle.org/26/en/Import_questions and specially the http://docs.moodle.org/26/en/Import_questions#WebCT_format paragraph.
          I still don't understand why some questions import formats have their own page linked on that page and other don't.
          The http://docs.moodle.org/26/en/WebCT_format page seems particularly useless, maybe it would be best once http://docs.moodle.org/26/en/Import_questions is updated to delete http://docs.moodle.org/26/en/WebCT_format ?
          I will try to update http://docs.moodle.org/26/en/Import_questions#WebCT_format as soon as I can but unfortunately these days my schedule is rather chaotic. But I will do it.
          In short webCT import format is now able to import a lot of WebCT questions types (shortanswer, multichoice single answer and multichoice multiple answers, calculated and essay (that WebCT calls "paragraph" questions) and also it can import webCT zip files containing questions and images embedded in questions.

          Show
          Jean-Michel Vedrine added a comment - Hello Mary, I think the main thing is to edit the page http://docs.moodle.org/26/en/Import_questions and specially the http://docs.moodle.org/26/en/Import_questions#WebCT_format paragraph. I still don't understand why some questions import formats have their own page linked on that page and other don't. The http://docs.moodle.org/26/en/WebCT_format page seems particularly useless, maybe it would be best once http://docs.moodle.org/26/en/Import_questions is updated to delete http://docs.moodle.org/26/en/WebCT_format ? I will try to update http://docs.moodle.org/26/en/Import_questions#WebCT_format as soon as I can but unfortunately these days my schedule is rather chaotic. But I will do it. In short webCT import format is now able to import a lot of WebCT questions types (shortanswer, multichoice single answer and multichoice multiple answers, calculated and essay (that WebCT calls "paragraph" questions) and also it can import webCT zip files containing questions and images embedded in questions.

            People

            • Votes:
              6 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: