-
-
Notifications
You must be signed in to change notification settings - Fork 80
fix logic for when to check answer hints #1317
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
base: develop
Are you sure you want to change the base?
Conversation
We had a discussion of some of this in my response to #1171, were I argued that
I still stand by this. If you are trying to distinguish $f = Formula("ln(|x|)")->with(test_points => [[-3],[-2],[-1],[1],[2],[3]]); or $f = Formula("ln(|x|)")->with(test_at => [[-1],[1]]); in order to force checks at negative values that will distinguish between the two forms. Without that, there is no guarantee that the points selected for You don't give the code of the problem that inspired this PR, so I can't tell if you have included such test points, but there are additional subtleties when using First, when two formulas When the answer hints are checked, however, the correct answer isn't involved, as the check is between the answer from the hint list and the student answer. That is, if the hint answer is If To distinguish $f = Formula("ln(x)")->with(test_at => [[-1], [1]]); but if you try this, you will see that $f = Formula("ln(x)")->with(test_at => [[-1], [1]], checkUndefinedPoints => 1); then With this in mind, if you have $ans = Formula("ln|x|")->with(test_at => [[-1], [1]]); as the correct answers, then use $ans->cmp->withPostFilter(AnswerHints(
Formula("ln(x)")->with(test_at => [[-1], [1]], checkUndefinedPoints => 1) => [
"(your message here)",
replaceMessage => 1,
]
)) as the answer evaluator. Note that One would have liked to have used $ans->cmp->withPostFilter(AnswerHints(
"ln(x)" => [
"(your message here)",
replaceMessage => 1,
cmp_options=> [test_at => [[-1], [1]], checkUndefinedPoints => 1]
]
)) or better yet $ans = Formala("ln|x|");
$ans->cmp(test_at => [[-1], [1]], checkUndefinedPoints => 1)->withPostFilter(AnswerHints(
"ln(x)" => ["(your message here)", replaceMessage => 1]
)) instead, but it turns out that the my $context = $self->context;
my $hash = $context->{answerHash};
$context->{answerHash} = $ans; to the $context->{answerHash} = $hash; before the pg/macros/answers/answerHints.pl Line 123 in b056613
to right before the return in that function as well, so that the main answer hash flags will be available throughout. (The changes to One might argue that needing to specify the test points is more complicated for authors and that it is easier to use the If you really want to move forward with a change like this, then I would recommend setting the default for In particular, if you aren't taking care to force negative test points with So even with your changes, you have to be thinking about test points properly, and if you are already doing that for the correct answer, you should be doing so for the answer hints as well. Skipping answers when the student answer is "correct" in this case leads to marking some incorrect answers as correct. So I stand by my original claim above: explicit answers in the list should always be checked. I agree with you, however, that some of the checks should be moved earlier. Again, in #1171, I mentioned that
but since that PR was closed without merging, this was not done at that time. I also point out that
Of course the |
I was using answerHints.pl for an answer that should be like ln|x|, and wanted a special message if the student entered ln(x). I noticed the answer hint was given even when the student enters ln|x|. And even though the default setting for
checkCorrect
is 0.It turned out that
checkCorrect
was only respected if the specified wrong answer was given as code, rather than given as a MathObject. So I adjusted the logic to wrap a check around the entire loop, checking ifcheckCorrect
is 1 or if the score is less than 1. While doing this, it seemed a few other things should be checked outside of the loop as well. Namely, the check forcheckTypes
, and the check for if a prior message should be replaced.