Notice: Undefined index: correct in CqMapping->init() (line 47 of /home/adam/contrib/closedquestion/question/mapping/CqMapping.class.php).
Here's the XML for the question producing this notice:
<question type="fillblanks">
<text>
<p>This phrase is used to practice typing because it contains all 26 letters of the alphabet.<br/>Fill in the missing word!</p>
<p><b>The quick brown <inlineChoice identifier="c" freeform="1"/> jumps over the lazy dog's tail</b></p>
</text>
<hint mintries="1">It's an animal.</hint>
<hint mintries="2">The answer starts with an f.</hint>
<hint mintries="3">The answer is f _ x.</hint>
<mapping correct="1">
<feedback>Very good!</feedback>
<match inlinechoice="c" pattern="^(fox|Fox)$"/>
</mapping>
<mapping>
<feedback>Wrong animal! Not a dog, dude.</feedback>
<match inlinechoice="c" pattern="dog"/>
</mapping>
</question>
I created this XML using the GUI editor after starting with the "Fillblanks question with math" template, then I inserted the line breaks and spaces manually.
Comments
Comment #1
adamdicarlo commentedI had a feeling what the problem was, so I changed
<mapping>to<mapping correct="0">and the notice went away.The thing is, I can't seem to force the XML editor to include the correct attribute for incorrect values. I've tried changing the mapping element to incorrect, hitting Save mapping, and then changing it back -- the editor removes the attribute every time I hit Save mapping with correct set to 0.
So I still think this is a notice bug.
Comment #2
jvdkolk commentedHi adamdicarlo,
I am not sure this is a bug: 'No' is the default setting for a mapping, so the editor indeed removes it.
I included a small patch to solve this. Are you able to test it?
Comment #3
adamdicarlo commentedPatch works for me... and pretty trivial so I'd call it RTBC.
Comment #4
jvdkolk commentedYou are welcome.
I happen to know that the maintainer of ClosedQuestion is busy with another project for about 4 weeks, but after that, the patch will find its way to the dev version :)
Comment #5
HylkeVDS commentedThanks for the patch!
I've applied it to dev, both for the D6 and the D7 version.
Comment #6
adamdicarlo commentedThank you @rekcor and @HylkeVDS!