-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix bugs with answerHints from issue #964 #974
Conversation
ff5dce6
to
9bc48db
Compare
Each issue has a MWE problem to test. For me, they both work following these changes. |
c8a9125
to
3fba804
Compare
I thought we merged this yesterday and so last night, I closed the two issues tied to this. Sorry! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, and works well in my testing. This makes answer hints work well with parserRadioButtons.pl
, parserCheckboxLists.pl
, and parserPopUp.pl
answers. See my comments on this in #964.
It is also good to fix the reference address issue.
I realized that I forgot to test issue #872 with this. The answer hints in the original MWE in that issue still do not work with this pull request. However, the errors that were begin shown are fixed. I added the suggestion of @dpvc to the MWE and that does get the answer hints to work (you need to replace backslashes with two tildes though do to translation). Here is the MWE that works: DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'parserNumberWithUnits.pl', 'answerHints.pl');
$ans = NumberWithUnits('1 m');
$cmp = $ans->cmp->withPostFilter(sub {
my $ansHash = shift;
if ($ansHash->{student_ans} =~ m/^~~s*(?:~~d+(?:~~.~~d*)?|~~.~~d+)~~s*$/) {
$ansHash->{student_value} = main::Real($ansHash->{student_ans});
$ansHash->{student_formula} = main::Formula($ansHash->{student_value});
}
return $ansHash;
})->withPostFilter(AnswerHints(2 => [ 'no', replaceMessage => 1 ]));
BEGIN_PGML
Enter [`[$ans]`].
[_]{$cmp}{10}
END_PGML
ENDDOCUMENT(); |
Do I understand right that this can be merged, and #964 can remain closed, but #872 should be reopened but with extended comments? I think we ultimately want something where you do not have to insert that postFilter, and so #872's original MWE remains an issue although not quite for the same reasons. Or maybe #872 remains closed but I open a new issue. |
This can be merged. If you want to re-open #872 or create another issue regarding creating an easier way to make answer hints work with radio buttons or checkboxes, that would be good. |
This fixes the issues discussed in #964.