Moodle
  1. Moodle
  2. MDL-17229 Shortanswer questiontype refactoring
  3. MDL-20380

Allow child classes to use their own display.html file without overloading print_question_formulation_and_controls

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.5
    • Fix Version/s: 1.9.10
    • Component/s: Questions
    • Labels:
      None
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      35841

      Description

      Allow child classes to use their own display.html file without overloading print_question_formulation_and_controls

        Issue Links

          Activity

          Hide
          Oleg Sychev added a comment -

          Patch is tested. Shortanswer works, numerical too.

          Show
          Oleg Sychev added a comment - Patch is tested. Shortanswer works, numerical too.
          Hide
          Tim Hunt added a comment -

          Oleg commented to me on Jabber that he wanted to do more work on this. Pushing out to 1.9.7 for now.

          Show
          Tim Hunt added a comment - Oleg commented to me on Jabber that he wanted to do more work on this. Pushing out to 1.9.7 for now.
          Hide
          Oleg Sychev added a comment -

          The main problem there is how to allow child classes to include additional code between code for determining the data to display and actually displaying it (so it could additionaly process displayed data, like, say, if preg question type will want to allow displaying submasks from match in feedback).

          MDL-20589 indicates that numerical question type is also waiting this improvment. Placing numerical code in shortanswer isn't good practice at all.

          Show
          Oleg Sychev added a comment - The main problem there is how to allow child classes to include additional code between code for determining the data to display and actually displaying it (so it could additionaly process displayed data, like, say, if preg question type will want to allow displaying submasks from match in feedback). MDL-20589 indicates that numerical question type is also waiting this improvment. Placing numerical code in shortanswer isn't good practice at all.
          Hide
          Oleg Sychev added a comment -

          I have a chance of adding to preg question functionality similar to the Joseph's regex question, and so to display correct and incorrect parts on student's answer. So this problem becomes urgent at last since I don't want to copy all shortanswer code in print_question_formulation_and_controls.

          I said you are going to convert question types to the renderers, that also would resolve this problem. When this would happen?

          Show
          Oleg Sychev added a comment - I have a chance of adding to preg question functionality similar to the Joseph's regex question, and so to display correct and incorrect parts on student's answer. So this problem becomes urgent at last since I don't want to copy all shortanswer code in print_question_formulation_and_controls. I said you are going to convert question types to the renderers, that also would resolve this problem. When this would happen?
          Hide
          Tim Hunt added a comment -

          OK, it is a small patch, and it looks fine, apart from some whitespace errors which I will fix, so I will commit it as soon as CVS lets me. I am having problems at the moment (MDLSITE-950).

          The question types are converted to renderers in my question engine rewrite. http://docs.moodle.org/en/Development:Question_Engine_2.

          And that is nearly finished. You can download and install it from http://github.com/timhunt/Moodle-Question-Engine-2 and it all works. I would like it if you built your new question type to work with that, but you probably want to build it in 1.9 so you can use it.

          I don't think I will add any new question types to Moodle core until after the rewrite has been added. That will hopefully be early in the Moodle 2.1 development cycle, so new question types can go into core in 2.1.

          So, until then, any regex question type will have to be in contrib.

          Show
          Tim Hunt added a comment - OK, it is a small patch, and it looks fine, apart from some whitespace errors which I will fix, so I will commit it as soon as CVS lets me. I am having problems at the moment ( MDLSITE-950 ). The question types are converted to renderers in my question engine rewrite. http://docs.moodle.org/en/Development:Question_Engine_2 . And that is nearly finished. You can download and install it from http://github.com/timhunt/Moodle-Question-Engine-2 and it all works. I would like it if you built your new question type to work with that, but you probably want to build it in 1.9 so you can use it. I don't think I will add any new question types to Moodle core until after the rewrite has been added. That will hopefully be early in the Moodle 2.1 development cycle, so new question types can go into core in 2.1. So, until then, any regex question type will have to be in contrib.
          Hide
          Oleg Sychev added a comment -

          My short term goal now is to get working prototype ASAP, so the other people could participate in testing main algorithm (could you or someone else from OU participate in the testing? It basically needs a supply of weird regexes and strings for matching.). There are number of unit tests, but a regular expression matching algorithm is a place where you can't be too sure...

          So my best guess is beta version under 1.9 following release (there are many things to polish yet) under 2.0 But if I correctly understand you rewrite isn't going in 2.0. I definitely will upgrade this type to it when it get to Moodle core, it should be not hard and resolve some problems with hit penalty we are having now.

          I don't have any illusions about such unlikely event as regular expression matching algorithm (DFA in this case) been quickly accepted in the Moodle core. If it is possible at all, it is already good news So it's perfectly OK in contrib, but the less copied code it will contain the better. It will also get me more time to polish it and make it a full superset of Joseph's question in terms of features

          Show
          Oleg Sychev added a comment - My short term goal now is to get working prototype ASAP, so the other people could participate in testing main algorithm (could you or someone else from OU participate in the testing? It basically needs a supply of weird regexes and strings for matching.). There are number of unit tests, but a regular expression matching algorithm is a place where you can't be too sure... So my best guess is beta version under 1.9 following release (there are many things to polish yet) under 2.0 But if I correctly understand you rewrite isn't going in 2.0. I definitely will upgrade this type to it when it get to Moodle core, it should be not hard and resolve some problems with hit penalty we are having now. I don't have any illusions about such unlikely event as regular expression matching algorithm (DFA in this case) been quickly accepted in the Moodle core. If it is possible at all, it is already good news So it's perfectly OK in contrib, but the less copied code it will contain the better. It will also get me more time to polish it and make it a full superset of Joseph's question in terms of features
          Hide
          Tim Hunt added a comment -

          Sounds good.

          This sounds like a perfect place to write lots of unit tests.

          OU does not really use regexes. We have our own matching library that seems to be a bit better. It is not in Moodle yet, just in OpenMark, but we plan to add it to Moodle. Have you seen this paper, written by two of my colleagues, it is quite interesting: http://www.sciencedirect.com/science?_ob=ArticleURL&_udi=B6VCJ-4YGHGMV-1&_user=126980&_coverDate=09%2F30%2F2010&_rdoc=1&_fmt=high&_orig=search&_sort=d&_docanchor=&view=c&_searchStrId=1416908095&_rerunOrigin=scholar.google&_acct=C000010439&_version=1&_urlVersion=0&_userid=126980&md5=1bda8036db2056687deedf9d62d45068

          Show
          Tim Hunt added a comment - Sounds good. This sounds like a perfect place to write lots of unit tests. OU does not really use regexes. We have our own matching library that seems to be a bit better. It is not in Moodle yet, just in OpenMark, but we plan to add it to Moodle. Have you seen this paper, written by two of my colleagues, it is quite interesting: http://www.sciencedirect.com/science?_ob=ArticleURL&_udi=B6VCJ-4YGHGMV-1&_user=126980&_coverDate=09%2F30%2F2010&_rdoc=1&_fmt=high&_orig=search&_sort=d&_docanchor=&view=c&_searchStrId=1416908095&_rerunOrigin=scholar.google&_acct=C000010439&_version=1&_urlVersion=0&_userid=126980&md5=1bda8036db2056687deedf9d62d45068
          Hide
          Oleg Sychev added a comment -

          Tim, I'm tried all possibilities, but can't find access to the sciencedirect.com in our universities, so I'm unable to read this article. If you can, please e-mail me article or at least an abstract from it.

          Show
          Oleg Sychev added a comment - Tim, I'm tried all possibilities, but can't find access to the sciencedirect.com in our universities, so I'm unable to read this article. If you can, please e-mail me article or at least an abstract from it.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: