Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-36243

question->questiontext and question->generalfeedback should always be strings

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.5, 2.3.2, 2.4
    • Fix Version/s: 2.2.7, 2.3.4, 2.4.1
    • Component/s: Questions
    • Labels:
    • Testing Instructions:
      Hide

      This code doesn't bring any new feature or fix any non working feature. It's just code improvement as asked by Eloy in his comment to MDL-35147
      So we are only testing there is no regression
      All tests should be conducted with developer debugging set to enabled to verify that no error or warning is displayed during imports.

      TEST IMPORT OF AN "ASSESSEMENT QTI" .ZIP ARCHIVE WITH SOME IMAGES

      Download the testgen_images.ZIP file attached to MDL-25492 tracker issue.
      Try to import this file file using the "Blackboard V6+" file format. Verify no warnings are displayed during import. You should also get no notification of missing image.
      This file should import 1 MCQ question with name : Describe this image. Verify that both in preview and in editing the question text and each choice display a book image (the right answer is not what you may think first).
      Looking at the question text the image src should be a valid draftfile url ending with

      ppg__questions with image1127111308__f1q1g1.jpg


      Looking at the choice with the image that looks the same, the img src should be a valid draftfile url ending with

      ppg__questions with image1127111308__f1q1g3.jpg

      TEST IMPORT OF A "QUESTION POOL" .ZIP ARCHIVE WITH SOME IMAGES

      Download the 6.4 greeks.zip file from http://moodle.tccsa.net/tccsa2/mod/resource/view.php?id=635 1072 ko. Try to import this file file using the "Blackboard V6+" file format. Verify no warnings are displayed during import. You should also get no notification of missing image.
      This file should import 12 MCQ questions. One of these questions has a name that display as * but is in fact * followed by a non breaking space entity. This name is wierd but is the expected result as we don't want any image included in question's names.
      Preview this question, it should diplay an image with some text in the question's text (text in the image begin by atlas), verify it is working as expected, the right answer is Greeks.
      Open the same question for editing and look at the html source of the question text. The image src should be a valid draftfile url with

      ppg__examview__6-4-greeks__mc009-1.jpg

      as last part, alt should be just "mc009-1.jpg".

      TEST THAT LESSON IMPORT IS STILL WORKING FOR ALL FORMATS

      As lesson don't support images import for now we only tests that the sample included in Moodle are correctly imported
      I don't think it is necessary to test all these files because if there is a regression, most likely all formats should be broken
      Create a lesson and try to import some questions from some of these files :

      • try to import the question/format/aiken/tests/fixtures/questions.aiken.txt
      • try to import the question/format/blackboard_six/tests/fixtures/sample_blackboard_pool.dat file
      • try to import the question/format/blackboard_six/tests/fixtures/sample_blackboard_qti.dat file
      • try to import the question/format/examview/tests/fixtures/examview_sample.xml file
      • try to import the question/format/gift/tests/fixtures/questions.gift.txt file

      TEST THAT QUESTION BANK IMPORT IS STILL WORKING

      Try to import questions from some of the files listed in the previous step in a category of the question bank.

      Show
      This code doesn't bring any new feature or fix any non working feature. It's just code improvement as asked by Eloy in his comment to MDL-35147 So we are only testing there is no regression All tests should be conducted with developer debugging set to enabled to verify that no error or warning is displayed during imports. TEST IMPORT OF AN "ASSESSEMENT QTI" .ZIP ARCHIVE WITH SOME IMAGES Download the testgen_images.ZIP file attached to MDL-25492 tracker issue. Try to import this file file using the "Blackboard V6+" file format. Verify no warnings are displayed during import. You should also get no notification of missing image. This file should import 1 MCQ question with name : Describe this image. Verify that both in preview and in editing the question text and each choice display a book image (the right answer is not what you may think first). Looking at the question text the image src should be a valid draftfile url ending with ppg__questions with image1127111308__f1q1g1.jpg Looking at the choice with the image that looks the same, the img src should be a valid draftfile url ending with ppg__questions with image1127111308__f1q1g3.jpg TEST IMPORT OF A "QUESTION POOL" .ZIP ARCHIVE WITH SOME IMAGES Download the 6.4 greeks.zip file from http://moodle.tccsa.net/tccsa2/mod/resource/view.php?id=635 1072 ko. Try to import this file file using the "Blackboard V6+" file format. Verify no warnings are displayed during import. You should also get no notification of missing image. This file should import 12 MCQ questions. One of these questions has a name that display as * but is in fact * followed by a non breaking space entity. This name is wierd but is the expected result as we don't want any image included in question's names. Preview this question, it should diplay an image with some text in the question's text (text in the image begin by atlas), verify it is working as expected, the right answer is Greeks. Open the same question for editing and look at the html source of the question text. The image src should be a valid draftfile url with ppg__examview__6-4-greeks__mc009-1.jpg as last part, alt should be just "mc009-1.jpg". TEST THAT LESSON IMPORT IS STILL WORKING FOR ALL FORMATS As lesson don't support images import for now we only tests that the sample included in Moodle are correctly imported I don't think it is necessary to test all these files because if there is a regression, most likely all formats should be broken Create a lesson and try to import some questions from some of these files : try to import the question/format/aiken/tests/fixtures/questions.aiken.txt try to import the question/format/blackboard_six/tests/fixtures/sample_blackboard_pool.dat file try to import the question/format/blackboard_six/tests/fixtures/sample_blackboard_qti.dat file try to import the question/format/examview/tests/fixtures/examview_sample.xml file try to import the question/format/gift/tests/fixtures/questions.gift.txt file TEST THAT QUESTION BANK IMPORT IS STILL WORKING Try to import questions from some of the files listed in the previous step in a category of the question bank.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull Master Branch:

      Description

      As part of MDL-25492 I changed question->questiontext and question->generalfeedback to be arrays when question are imported using the blackboard_six question import format.
      This needed adjustments both in question/format.php and in mod/lesson/format.php (see MDL-35147)
      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 this proposal is to find a way so that question object has a constant structure.
      This would permit to remove nearly entirely Eloy commit http://fisheye.moodle.org/changelog/Moodle?cs=1c3b1f7aee31ef897c08d16e1e4c094a69d727d5 becaus eit would not be necessary anymore.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    14/Jan/13