From: dpvc v. a. <we...@ma...> - 2008-11-19 15:49:38
|
Log Message: ----------- Fixed a bug where if the student answer has an evaluation error in a problem with adaptive parameters, the error message could incorrectly be displayed in the message area. The correct behavior is to mark the answer incorrect silently. Also, properly report errors in correct answer under similar circumstances. Modified Files: -------------- pg/lib/Value: Formula.pm Revision Data ------------- Index: Formula.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Formula.pm,v retrieving revision 1.62 retrieving revision 1.63 diff -Llib/Value/Formula.pm -Llib/Value/Formula.pm -u -r1.62 -r1.63 --- lib/Value/Formula.pm +++ lib/Value/Formula.pm @@ -446,10 +446,15 @@ foreach my $i (0..$d-1) { my @a = (); my @p = @{$p->[$i]}; foreach my $j (0..$d-1) { - $P[$j] = 1; push(@a,(&$f(@p,@P)-$v->[$i])->value); - $P[$j] = 0; + $P[$j] = 1; + my $y = eval {&$f(@p,@P)}; + $l->Error(["Can't evaluate correct answer at adapted point (%s)",join(",",@$p,@P)]) + unless defined $y; + push(@a,($y-$v->[$i])->value); + $P[$j] = 0; } - push @A, [@a]; push @b, [(&$F(@p,@P)-$v->[$i])->value]; + my $y = eval {&$F(@p,@P)}; return unless defined $y; + push @A, [@a]; push @b, [($y-$v->[$i])->value]; } # # Use MatrixReal1.pm to solve system of linear equations |