WeBWorK Problems

hints show, but not after the specified number of times

hints show, but not after the specified number of times

by Xiong Chiamiov -
Number of replies: 1
I'm playing around with the hints in problems, with a problem that includes the following snippet:

$showHint = 3;
BEGIN_HINT
$PAR HINT:
$BR
Intercepts are discussed in Lesson 2.

END_HINT 
I'm experiencing odd behavior, though, with when the hints are actually shown:
$showHint # of submits until "Show Hints" checkbox appears # of submits until hint actually appears
-2 0 1
-1 0 1
0 0 2
1 0 3
2 2 4
3 3 5
This is, I must admit, a bit baffling, so I'd be thankful for any insight on what it could be.
I'm testing the hints from a student account. The webwork installed is an updated version of rel-2-4-patches. The full problem file can be viewed here.
In reply to Xiong Chiamiov

Re: hints show, but not after the specified number of times

by Michael Gage -
Xiong,

Thanks for a very clear bug report -- it is indeed a bug. The chief culprit is an off-by-one error between the $numOfAttempts internal to the problem which controls when the hint appears and the $numOfAttempts variable external to the problem which determines when the checkbox appears. The expected behavior is that the hint will appear one submit after the showHint checkbox appears. A better behavior would be that pressing the preview button would show the hint if the checkbox is checked.

A robust fix will require reworking more than just a few lines of code so it will
not appear in the forthcoming release 2.4.7 which should be out in a few days.
It should be fixed in the next flurry of bug fixes posted to the rel-2-4-patches branch later this summer.

--Mike