Moodle
  1. Moodle
  2. MDL-32201

question_type::export_to_xml misses files in answers & feedback when using extra_answer_fields

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.5, 2.2.2
    • Fix Version/s: 2.1.6, 2.2.3
    • Component/s: Questions
    • Labels:
    • Testing Instructions:
      Hide

      To test this, you need to install a third-party question type that relies on the extra_answer_fields functionality, and the question type base class implementation of export_to_xml. I will use qtype_varnumericset here.

      0. Type
      git clone git://github.com/moodleou/moodle-qtype_varnumericset.git question/type/varnumericset
      or
      git clone -b MOODLE_21_STABLE git://github.com/moodleou/moodle-qtype_varnumericset.git question/type/varnumericset
      in the root of your Moodle install, as applicable. The go to admin to let the plugin install itself.

      1. Create a new varnumericset question in the question bank:
      Question name: VNS
      Question text: What is [[a]] + [[b]]?
      Variable 1: Predefined variable
      Name: a
      Value for variant 1: 1
      Value for variant 2: 2
      Variable 2: Predefined variable
      Name: b
      Value for variant 1: 3
      Value for variant 2: 4
      Answer 1: a + b
      Answer 1 grade: 100%
      Answer 1 feedback: Well done and then add an image in this HTML editor.
      then Save changes.

      1.5 You should probably also create some standard Moodle question in the same category, to make sure there are no regressions there.

      2. Export the category containing this question as Moodle XML.

      3. Import the XML file into another course.

      4. Edit the imported question, and make sure the image is still there in the answer feedback.

      4.5 If you made extra questions in step 1.5, check those too.

      Show
      To test this, you need to install a third-party question type that relies on the extra_answer_fields functionality, and the question type base class implementation of export_to_xml. I will use qtype_varnumericset here. 0. Type git clone git://github.com/moodleou/moodle-qtype_varnumericset.git question/type/varnumericset or git clone -b MOODLE_21_STABLE git://github.com/moodleou/moodle-qtype_varnumericset.git question/type/varnumericset in the root of your Moodle install, as applicable. The go to admin to let the plugin install itself. 1. Create a new varnumericset question in the question bank: Question name: VNS Question text: What is [ [a] ] + [ [b] ]? Variable 1: Predefined variable Name: a Value for variant 1: 1 Value for variant 2: 2 Variable 2: Predefined variable Name: b Value for variant 1: 3 Value for variant 2: 4 Answer 1: a + b Answer 1 grade: 100% Answer 1 feedback: Well done and then add an image in this HTML editor. then Save changes. 1.5 You should probably also create some standard Moodle question in the same category, to make sure there are no regressions there. 2. Export the category containing this question as Moodle XML. 3. Import the XML file into another course. 4. Edit the imported question, and make sure the image is still there in the answer feedback. 4.5 If you made extra questions in step 1.5, check those too.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      38959

      Description

      Actually, there was a TODO in the code saying that this code should be refactored to use $format->write_answer, and that will fix this problem.

        Activity

        Tim Hunt created issue -
        Hide
        Tim Hunt added a comment -

        I will cherry-pick to other branches once this has been peer-reviewed.

        Show
        Tim Hunt added a comment - I will cherry-pick to other branches once this has been peer-reviewed.
        Tim Hunt made changes -
        Field Original Value New Value
        Pull Master Diff URL https://github.com/timhunt/moodle/compare/master...MDL-32201
        Pull Master Branch MDL-32201
        Fix Version/s STABLE backlog [ 10463 ]
        Testing Instructions To test this, you need to install a third-party question type that relies on the extra_answer_fields functionality, and the question type base class implementation of export_to_xml. I will use qtype_varnumericset here.

        0. Type
            git clone git://github.com/moodleou/moodle-qtype_varnumericset.git question/type/varnumericset
        or
            git clone -b MOODLE_21_STABLE git://github.com/moodleou/moodle-qtype_varnumericset.git question/type/varnumericset
        in the root of your Moodle install, as applicable. The go to admin to let the plugin install itself.

        1. Create a new varnumericset question in the question bank:
        Question name: VNS
        Question text: What is [[a]] + [[b]]?
        Variable 1: Predefined variable
        Name: a
        Value for variant 1: 1
        Value for variant 2: 2
        Variable 2: Predefined variable
        Name: b
        Value for variant 1: 3
        Value for variant 2: 4
        Answer 1: a + b
        Answer 1 grade: 100%
        Answer 1 feedback: Well done and then add an image in this HTML editor.
        then Save changes.

        1.5 You should probably also create some standard Moodle question in the same category, to make sure there are no regressions there.

        2. Export the category containing this question as Moodle XML.

        3. Import the XML file into another course.

        4. Edit the imported question, and make sure the image is still there in the answer feedback.

        4.5 If you made extra questions in step 1.5, check those too.
        Pull from Repository git://github.com/timhunt/moodle.git
        Labels triaged
        Hide
        Tim Hunt added a comment -

        Oleg, any chance you could have a look at these changes. This is an area of the code you know quite well. Thanks.

        Show
        Tim Hunt added a comment - Oleg, any chance you could have a look at these changes. This is an area of the code you know quite well. Thanks.
        Tim Hunt made changes -
        Status Open [ 1 ] Waiting for peer review [ 10012 ]
        Peer reviewer oa_sychev
        Tim Hunt made changes -
        Status Waiting for peer review [ 10012 ] Development in progress [ 3 ]
        Hide
        Tim Hunt added a comment -

        I am confident this fix is right, so submitting for integration.

        Show
        Tim Hunt added a comment - I am confident this fix is right, so submitting for integration.
        Tim Hunt made changes -
        Status Development in progress [ 3 ] Waiting for integration review [ 10010 ]
        Peer reviewer oa_sychev
        Pull 2.1 Branch MDL-32201_21
        Pull 2.2 Diff URL https://github.com/timhunt/moodle/compare/MOODLE_22_STABLE...MDL-32201_22
        Pull 2.1 Diff URL https://github.com/timhunt/moodle/compare/MOODLE_21_STABLE...MDL-32201_21
        Pull 2.2 Branch MDL-32201_22
        Hide
        Eloy Lafuente (stronk7) added a comment -

        The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

        TIA and ciao

        Show
        Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
        Sam Hemelryk made changes -
        Currently in integration Yes [ 10041 ]
        Dan Poltawski made changes -
        Status Waiting for integration review [ 10010 ] Integration review in progress [ 10004 ]
        Integrator poltawski
        Hide
        Dan Poltawski added a comment -

        Thanks Tim - this has been integrated now.

        Show
        Dan Poltawski added a comment - Thanks Tim - this has been integrated now.
        Dan Poltawski made changes -
        Status Integration review in progress [ 10004 ] Waiting for testing [ 10005 ]
        Affects Version/s 2.3 [ 10657 ]
        Fix Version/s 2.1.6 [ 12052 ]
        Fix Version/s 2.2.3 [ 12053 ]
        Fix Version/s STABLE backlog [ 10463 ]
        Michael de Raadt made changes -
        Tester andyjdavis
        Dan Poltawski made changes -
        Status Waiting for testing [ 10005 ] Testing in progress [ 10011 ]
        Tester andyjdavis poltawski
        Hide
        Dan Poltawski added a comment -

        Pheww,

        tested on all 3 branches and looks good

        Show
        Dan Poltawski added a comment - Pheww, tested on all 3 branches and looks good
        Dan Poltawski made changes -
        Status Testing in progress [ 10011 ] Tested [ 10006 ]
        Hide
        Aparup Banerjee added a comment -

        The code here has been spread to upstream moodle repositories and mirrors for anyone to use .

        Closing, have a good weekend!

        Show
        Aparup Banerjee added a comment - The code here has been spread to upstream moodle repositories and mirrors for anyone to use . Closing, have a good weekend!
        Aparup Banerjee made changes -
        Status Tested [ 10006 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Currently in integration Yes [ 10041 ]
        Integration date 05/Apr/12

          People

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

            Dates

            • Created:
              Updated:
              Resolved: