I make a quiz with a Simple Calculated question in Moodle, with the following unit settings:
<unitpenalty>0.1000000</unitpenalty>
<showunits>2</showunits>
<unitsleft>0</unitsleft>
I make a quiz with a Simple Calculated question in Moodle, with the following unit settings:
More details...
When I import the quiz as XML, the SimpleCalc question looks OK.
But when the quiz was run, I discovered the units were not compulsory (despite the correct display of the pull-down menu making it appear to have imported correctly).
It is when you EDIT SETTINGS on that question, you see the default Unit Handling settings. (No units, text entry etc).
Then if you save and return to preview the quiz, the Unit Handling has reverted to those default settings. The pull-down menu has disappeared!
I DO NOT want to have to go through every imported XML calculated question and reset this Unit Handling. (We have hundreds of questions that I am porting from our in-house VB quiz program into Moodle).
I'm guessing there is some sort of fault with XML import of the tag... <unitgradingtype>1</unitgradingtype> ?
(Sorry I'm not much help with PHP at this stage, but I am having a bit of a guess... having written a quiz program in VB that I find quicker than Moodle for writing questions. But Moodle has the whole kit and kaboodle...
Hi Tim,
What you described is a bug but given the info it appears more in the edit_form.
I will try to locate the problem and set a bug.
Pierre
tracker MDL-32217
Could you attach here your quiz xml file
Pierre
your single file load correctly and on preview everything (units to choose from) is diplayed correctly because this is set by the showunits parameter although the value of unitgradingtype is set to 0 not 1
the following changes in numerical/questiontype.php
} else if (isset($question->showunits)) {
// Updated import, e.g. Moodle XML.
$options->showunits = $question->showunits;
$options->unitgradingtype = $question->unitgradingtype;
} else {
will solve the problem.
Then I have to set the tracker issue and resolve it with all the necessary testing steps...
Pierre
P.S. As they say everywhere, if you apply this patch, you are responsible of its effect
Excellent Piere!
Works perfectly in Moodle 2.2.1 and 2.2.2
On import (format.php)