Moodle

Notice about unit handling in shortanswer question

Details

  • Type: Bug Bug
  • Status: Development in progress Development in progress
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 2.0
  • Fix Version/s: None
  • Component/s: Questions
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE

Description

When attempting a shortanswer question in a HEAD after entering some data and sending it there is a PHP Notice:

Notice: Undefined property: question_shortanswer_qtype::$raw_unitpenalty
in Z:\home\moodle\www\question\type\shortanswer\questiontype.php on line 320

Issue Links

Activity

Hide
Pierre Pichet added a comment -

adding a test i.e. isset($this->raw_unitpenalty) && remove the problem.

Show
Pierre Pichet added a comment - adding a test i.e. isset($this->raw_unitpenalty) && remove the problem.
Hide
Oleg Sychev added a comment -

I think this problem indicates that shortanswer has a code about unit handling that it really shouldn't (i.e. code that belongs actually to numerical, which is it's child). So it's better to resolve it by moving code to the correct place IMHO.

Show
Oleg Sychev added a comment - I think this problem indicates that shortanswer has a code about unit handling that it really shouldn't (i.e. code that belongs actually to numerical, which is it's child). So it's better to resolve it by moving code to the correct place IMHO.
Hide
Pierre Pichet added a comment -

Strictly speaking you are rigth.
Short answer code is designed for one input response element and new numerical has 2 elements.
However, I did not want to duplicate all the print_question_grading_details code in numerical question type.
This is more a temporary patch but not the definitive solution.
New question engine will render this obsolete and Tim hope that it could be released for 2.0.

Show
Pierre Pichet added a comment - Strictly speaking you are rigth. Short answer code is designed for one input response element and new numerical has 2 elements. However, I did not want to duplicate all the print_question_grading_details code in numerical question type. This is more a temporary patch but not the definitive solution. New question engine will render this obsolete and Tim hope that it could be released for 2.0.
Hide
Oleg Sychev added a comment -

Pierre - if you need in numerical (child) class to insert a new controls after (or before) existing (in shortanswer) ones it could be done without duplicating print_question_grading_details using parent function call in inherited function (for example backup function for shortanswer now use parent call to call basic question backup).

It is worse in case you are want to insert new controls (information) in the middle of existing ones thought.

Show
Oleg Sychev added a comment - Pierre - if you need in numerical (child) class to insert a new controls after (or before) existing (in shortanswer) ones it could be done without duplicating print_question_grading_details using parent function call in inherited function (for example backup function for shortanswer now use parent call to call basic question backup). It is worse in case you are want to insert new controls (information) in the middle of existing ones thought.
Hide
Pierre Pichet added a comment -

Don't worry, like a teen-ager, I use parent as much as possible.

The case here is the "It is worse in case you are want to insert new controls (information) in the middle of existing ones thought."

Show
Pierre Pichet added a comment - Don't worry, like a teen-ager, I use parent as much as possible. The case here is the "It is worse in case you are want to insert new controls (information) in the middle of existing ones thought."
Hide
Oleg Sychev added a comment -

Then this issue is even more tied up with MDL-20380. We must wait for Tim to finish his work on question enginge and start converting qtypes to the renderers to see how this issue could be properly resolved.

In the meantime, I guess the proper form of a check would be not isset(something). It would be better to check for $this->name()=='numerical' (or something similar if you have a children of numerical) to ensure that numerical code get executed in numerical quesion type.

Show
Oleg Sychev added a comment - Then this issue is even more tied up with MDL-20380. We must wait for Tim to finish his work on question enginge and start converting qtypes to the renderers to see how this issue could be properly resolved. In the meantime, I guess the proper form of a check would be not isset(something). It would be better to check for $this->name()=='numerical' (or something similar if you have a children of numerical) to ensure that numerical code get executed in numerical quesion type.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: