Hi, all,
I cannot get answerHints to work in a problem I'm trying to write. (ww_version: 2.19 | pg_version 2.19) I've including a snippet of the problem below.
1) It does not send the error message when the conditions are met
2) The computed answer will not show up (I'm including a photo of that shows up when it is referenced)
3) A warning message is given when the answer is checked (also in the photo)
Thanks -- rac
--------------Problem snippet-------------------------
DOCUMENT();
l oadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGML.pl",
"parserNumberWithUnits.pl",
"answerHints.pl",
);
Context()->flags->set(
tolerance => 2, #--use more tolerance since reading from a graph----
tolType => 'absolute',
);
$distance = 9; #--test----
$km1 = NumberWithUnits("$distance km")->cmp->withPostFilter(AnswerHints(
sub {
my ($correct, $student, @ans) = @_;
return (abs($correct-$student)<5 && abs($correct-$student)>2);
} => ['Your answer is close. Look at the graph more carefully.']
));
###############################
BEGIN_PGML
What is the distance between the towns (answer: [$distance] km) : [_]{$km1}
[`[$km1]`]
END_PGML
ENDDOCUMENT();