Moodle
  1. Moodle
  2. MDL-19072

XHTML export for match questions create additional select controls for wrong answers

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.9.4, 2.3.6, 2.4.3
    • Fix Version/s: 2.3.7, 2.4.4
    • Component/s: Questions
    • Labels:
      None
    • Testing Instructions:
      Hide
      1. Create a matching question with at least 3 subquestion/subanswer couples and also one subanswer with an empty subquestion.
      2. Export the category containing this matching question using XHTML export format.
      3. Look at the resulting web page (either at the source code of in a browser) there should be exactly 3 select menus, no more, and 4 options should be available in each one including the subanaswer without matching subquestion.

      Example question:

      Match each little pig with his house:
      Fifer pig -> House of straw
      Fiddler pig -> House of sticks
      Practical pig -> House of bricks
      (empty) -> House of candy

      Note that there were some merge conflicts going to 2.3, so be sure to test both stable branches.

      Show
      Create a matching question with at least 3 subquestion/subanswer couples and also one subanswer with an empty subquestion. Export the category containing this matching question using XHTML export format. Look at the resulting web page (either at the source code of in a browser) there should be exactly 3 select menus, no more, and 4 options should be available in each one including the subanaswer without matching subquestion. Example question: Match each little pig with his house: Fifer pig -> House of straw Fiddler pig -> House of sticks Practical pig -> House of bricks (empty) -> House of candy Note that there were some merge conflicts going to 2.3, so be sure to test both stable branches.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull 2.4 Branch:
    • Pull Master Branch:
    • Rank:
      7051

      Description

      It seems that when adding a possibility to define additional wrong answers to a match question it seems that it was forgotten to add it handling to XHTML export, so it create additional controls for such answers with empty text.

      Should be very easy to fix.

        Activity

        Hide
        Tim Hunt added a comment -

        Import export, so -> Howard in the first instance. If you don't want it Howard, feel free to assign it back to me.

        Show
        Tim Hunt added a comment - Import export, so -> Howard in the first instance. If you don't want it Howard, feel free to assign it back to me.
        Hide
        Howard Miller added a comment -

        It's fine.... keep 'em coming

        Show
        Howard Miller added a comment - It's fine.... keep 'em coming
        Hide
        Martin Dougiamas added a comment -

        I may be assigning this one to Moodle developer job applicants.

        Some info to reproduce.

        1) Install Moodle and create a course
        2) In the course, visit "questions" in the "Course admin" block on the left
        3) "Create a new question" of type "Matching".
        4) Fill out the first three matched question/answers.
        5) Use the "Blanks for more choices" button to get some more form fields
        6) Add answers for these extra ones, not questions.
        7) Save the quesiton.
        8) Go to the "Export" tab, and export as "XHTML" format, then download and view the .html file

        What you will see:

        The three "questions", each with a menu to choose from, plus some extra menus.

        What it should look like:

        Just the first three questions+menus. The extra ones shouldn't be there.

        Show
        Martin Dougiamas added a comment - I may be assigning this one to Moodle developer job applicants. Some info to reproduce. 1) Install Moodle and create a course 2) In the course, visit "questions" in the "Course admin" block on the left 3) "Create a new question" of type "Matching". 4) Fill out the first three matched question/answers. 5) Use the "Blanks for more choices" button to get some more form fields 6) Add answers for these extra ones, not questions. 7) Save the quesiton. 8) Go to the "Export" tab, and export as "XHTML" format, then download and view the .html file What you will see: The three "questions", each with a menu to choose from, plus some extra menus. What it should look like: Just the first three questions+menus. The extra ones shouldn't be there.
        Hide
        Howard Miller added a comment -

        Fair enough... let me know if it falls through otherwise I'll leave it with you.

        Show
        Howard Miller added a comment - Fair enough... let me know if it falls through otherwise I'll leave it with you.
        Hide
        Michael de Raadt added a comment -

        Thanks for reporting this issue.

        We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

        If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

        Michael d;

        lqjjLKA0p6

        Show
        Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; lqjjLKA0p6
        Hide
        Oleg Sychev added a comment -

        The problem seems to exists judging by testing on qa.moodle.net. Please fix it already...

        Show
        Oleg Sychev added a comment - The problem seems to exists judging by testing on qa.moodle.net. Please fix it already...
        Hide
        Michael de Raadt added a comment -

        Thanks for reporting this issue.

        We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

        If you believe that this issue is still relevant to current versions (2.3 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

        Michael d;

        4d6f6f646c6521

        Show
        Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.3 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; 4d6f6f646c6521
        Hide
        Oleg Sychev added a comment -

        It still creating those additional controls, tested on qa.moodle.net. The problem remains.

        Show
        Oleg Sychev added a comment - It still creating those additional controls, tested on qa.moodle.net. The problem remains.
        Hide
        Jean-Michel Vedrine added a comment -

        I will fix this bug. XHTML format would need more work but I don't know if it is widely used ?

        Show
        Jean-Michel Vedrine added a comment - I will fix this bug. XHTML format would need more work but I don't know if it is widely used ?
        Hide
        Jean-Michel Vedrine added a comment -

        If more work was to be done on the XHTML format, IMHO what would be interesting would be to create a way for each question type to define a renderer so that this format is extensible to third party question types. Once that is done we could create a quiz report that could "print" a quiz using the same renderers (an often requested feature).

        Show
        Jean-Michel Vedrine added a comment - If more work was to be done on the XHTML format, IMHO what would be interesting would be to create a way for each question type to define a renderer so that this format is extensible to third party question types. Once that is done we could create a quiz report that could "print" a quiz using the same renderers (an often requested feature).
        Hide
        Jean-Michel Vedrine added a comment -

        Committed a minimal fix.
        When we will be satisfied with master branch I will backport to stable branchs.
        But the code of this format is still not up to Moodle standards.
        Before creating another tracker issue to do further work on this format, my proposal is to write a message in the quiz forum asking

        • who use this export format
        • what for they use it (printing question, creating a form to be used outside of Moodle, ...)
        • what additional features would be useful

        And to decide after looking at the answers what to do with this format.

        Show
        Jean-Michel Vedrine added a comment - Committed a minimal fix. When we will be satisfied with master branch I will backport to stable branchs. But the code of this format is still not up to Moodle standards. Before creating another tracker issue to do further work on this format, my proposal is to write a message in the quiz forum asking who use this export format what for they use it (printing question, creating a form to be used outside of Moodle, ...) what additional features would be useful And to decide after looking at the answers what to do with this format.
        Hide
        Jean-Michel Vedrine added a comment - - edited

        I forgot to ask peer review !
        this can wait as this is a bug fix so better after 2.5 code freeze.

        Show
        Jean-Michel Vedrine added a comment - - edited I forgot to ask peer review ! this can wait as this is a bug fix so better after 2.5 code freeze.
        Hide
        Tim Hunt added a comment -

        Code change looks good. I think this just needs to be back-ported to stable branches, then we can submit it for integration.

        Show
        Tim Hunt added a comment - Code change looks good. I think this just needs to be back-ported to stable branches, then we can submit it for integration.
        Hide
        Oleg Sychev added a comment -

        I agree with the fix, its easy enought.

        to Jean-Michel on you comment "IMHO what would be interesting would be to create a way for each question type to define a renderer so that this format is extensible to third party question types".

        I think that it is quite possible to use existing question renderers for export, using PHP functionality to save HTML output for postprocessing (like http://www.php.net/manual/en/book.outcontrol.php), instead of creating a new ones. As you can see on the moodle.org, I'm project leader on two 3d party question types, by the way.

        Show
        Oleg Sychev added a comment - I agree with the fix, its easy enought. to Jean-Michel on you comment "IMHO what would be interesting would be to create a way for each question type to define a renderer so that this format is extensible to third party question types". I think that it is quite possible to use existing question renderers for export, using PHP functionality to save HTML output for postprocessing (like http://www.php.net/manual/en/book.outcontrol.php ), instead of creating a new ones. As you can see on the moodle.org, I'm project leader on two 3d party question types, by the way.
        Hide
        Jean-Michel Vedrine added a comment -

        Hello Tim,
        Backported to stable branchs and testing instructions added.
        Fix for 23_STABLE is a little different due to differences in code. I don't know if that means it should be tested on that branch too, and if I need to add that precision to testing instructions ?

        Show
        Jean-Michel Vedrine added a comment - Hello Tim, Backported to stable branchs and testing instructions added. Fix for 23_STABLE is a little different due to differences in code. I don't know if that means it should be tested on that branch too, and if I need to add that precision to testing instructions ?
        Hide
        Dan Poltawski added a comment -

        Integrated to master, 24 and 23.

        Thanks, this is an old one!

        Show
        Dan Poltawski added a comment - Integrated to master, 24 and 23. Thanks, this is an old one!
        Hide
        Rossiani Wijaya added a comment -

        This is working as expected.

        Tested for 2.3, 2.4 and master.

        Test passed.

        Show
        Rossiani Wijaya added a comment - This is working as expected. Tested for 2.3, 2.4 and master. Test passed.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Your awesome contributions are now part of Moodle, your fav LMS out there.

        Closing this as fixed.

        Many thanks for all the hard work, ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Your awesome contributions are now part of Moodle, your fav LMS out there. Closing this as fixed. Many thanks for all the hard work, ciao

          People

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

            Dates

            • Created:
              Updated:
              Resolved: