WeBWorK Problems

Custom checkers on lists: Why different for lists of one item?

Re: Custom checkers on lists: Why different for lists of one item?

by Alex Jordan -
Number of replies: 0
Chiming in from a conference. I haven't had a chance to review your code, but I encountered the same (or a similar) issue in coding some problems a while back. I believe that if the answer is like List(Fraction(1,2)), then the list checker at some level incorrectly treats the answer like it was a list of two objects. I guess this is because Fraction(1,2)->value is itself a list of two objects.

To my recollection, this didn't really cause trouble with the part of my custom answer checking that did the checking, but it caused trouble with the part that did the scoring. In the above, the checker found 1 correct answer, but divided by 2 to give the student's score. This was specific to a list of one object; List(Fraction(1,2),Fraction(3,4)) behaved well.

So my hack in the custom checker was just to check if there was only one object in the list, and if the result was correct, increase the correct count from 1 to 2, and let the division by 2 happen to get 100%. I should not have done it this way. I should have researched the actual issue and fixed it, because now if it is fixed, I will have to undo my hack. (Thankfully the hack was only applied in a macro file, not individual problems, so I'll be able to undo the hack easily enough when the time comes.)