Consider the following MWE
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGML.pl",
"contextForm.pl",
"scaffold.pl",
);
Context("Form");
$ans = Formula("x/2");
#Scaffold::Begin();
#Section::Begin("");
BEGIN_PGML
[`\frac{x}{2}=`][_]{$ans}
END_PGML
#Section::End();
#Scaffold::End();
I think it works just fine. You can enter "x/2" and it is correct. Or "2x/4" and get a special feedback message.
Now uncomment the four lines for scaffolding. And then enter "x/2" as an answer. At some level it is assessed as correct because the scaffold styling turns green. However the results table says it is incorrect and there is red styling around the input field. If I peek inside the results hash, the score is 0 (which is probably what leads to the result table saying it is incorrect and the red styling).
If I change the context from Form to Numeric, then the issue is not there. Alternatively, leave it in context Form and change the answer to just be "x". Then there is no problem either. ("x" is completely regarded as correct and "2x/2" gives a special feedback message.)
On the one hand, since this works without scaffolding, I would think something is not handled correctly in scaffold.pl. I looked in there though and could not see what the issue might be. Although a suspect is the code in `sub section_answers`.
On the other hand, I have little confidence that I wrote the answer checker for contextForm.pl in the right way (in the OPL PCC macros folder). Maybe it can be written in some more robust way that will work with scaffold.pl.
Is anyone available to help me figure this out?