Gavin LaRose - fun_cmp, OR, and empty answers 5/4/2004; 12:33:47 PM (reads: 602, responses:
1) |
Hi all,
Well, I tried to post this and it bailed. Take two. I have
an answer evaluator that uses fun_cmp() to compare a student answer
with the two answers y1 = A f(t) + B g(t) and y2 = A g(t) + B f(t),
then OR()s the resulting AnswerHashs and returns the result. I
thought this showed up on the discussion list sometime before this, but
I can't find it now.
The odd thing is that when the problem is loaded with no answers
entered, there's an "unintialized value" error coming from
AnswerHash.pm line 411, which is
$out_hash->{preview_text_string} = join(" ",
$self->{preview_text_string}, $rh_ans2->{preview_text_string} );
($self and $rh_ans2 are the AnswerHashs from evaluating the student answer against fun_cmp()). Replacing this with
$out_hash->{preview_text_string} = join(" ", (defined(
$self->{preview_text_string} ) ? $self->{preview_text_string} :
''), (defined( $rh_ans2->{preview_text_string} ) ?
$rh_ans2->{preview_text_string} : '') );
resolves the problem.
It seems odd that there would be a problem with this in the OR() but
not in fun_cmp() itself. Or maybe I'm just more tired than I
thought.
In any event, comments and thoughts are welcome.
Gavin
<| Post or View Comments |>
|
|