From: dpvc v. a. <we...@ma...> - 2005-09-17 13:02:06
|
Log Message: ----------- The Parser answer checkers used to give the student answer as the parsed but unevaluated answer. This has been changed so that the student answer is now the computed result, no the parsed answer. The answer preview still shows the parsed equation. This is more consistent with the traditional answer checkers, and probably is more valuable to the students. Modified Files: -------------- pg/lib/Value: AnswerChecker.pm Revision Data ------------- Index: AnswerChecker.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/AnswerChecker.pm,v retrieving revision 1.63 retrieving revision 1.64 diff -Llib/Value/AnswerChecker.pm -Llib/Value/AnswerChecker.pm -u -r1.63 -r1.64 --- lib/Value/AnswerChecker.pm +++ lib/Value/AnswerChecker.pm @@ -105,7 +105,7 @@ unless Value::isValue($ans->{student_value}); $ans->{preview_latex_string} = $ans->{student_formula}->TeX; $ans->{preview_text_string} = protectHTML($ans->{student_formula}->string); - $ans->{student_ans} = $ans->{preview_text_string}; + $ans->{student_ans} = protectHTML($ans->{student_value}->string); if ($self->cmp_collect($ans)) { $self->cmp_equal($ans); $self->cmp_postprocess($ans) if !$ans->{error_message}; @@ -366,7 +366,7 @@ else {$sep = '</TD><TD WIDTH="8px"></TD><TD>'} foreach my $i (0..$rows-1) { $HTML .= '<TR><TD HEIGHT="6px"></TD></TR>' if $i; - $HTML .= '<TR ALIGN="MIDDLE"><TD>'.join($sep,@{$array->[$i]}).'</TD></TR>'."\n"; + $HTML .= '<TR ALIGN="MIDDLE"><TD>'.join($sep,EVALUATE(@{$array->[$i]})).'</TD></TR>'."\n"; } $open = $self->format_delimiter($open,$rows,$options{tth_delims}); $close = $self->format_delimiter($close,$rows,$options{tth_delims}); @@ -387,6 +387,8 @@ . '</TABLE>'; } +sub EVALUATE {map {(Value::isFormula($_) && $_->isConstant? $_->eval: $_)} @_} + sub VERBATIM { my $string = shift; my $displayMode = Value->getPG('$displayMode'); |