| … | |
… | |
| 1114 | 'zeroLevel' => $numZeroLevelDefault, |
1114 | 'zeroLevel' => $numZeroLevelDefault, |
| 1115 | 'zeroLevelTol' => $numZeroLevelTolDefault, |
1115 | 'zeroLevelTol' => $numZeroLevelTolDefault, |
| 1116 | 'tolType' => 'relative', |
1116 | 'tolType' => 'relative', |
| 1117 | 'tolerance' => 1, |
1117 | 'tolerance' => 1, |
| 1118 | 'reltol' => undef, #alternate spelling |
1118 | 'reltol' => undef, #alternate spelling |
| 1119 | 'unit' => undef); #alternate spelling |
1119 | 'unit' => undef, #alternate spelling |
|
|
1120 | 'debug' => 0 |
|
|
1121 | |
|
|
1122 | ); |
| 1120 | |
1123 | |
| 1121 | my @output_list; |
1124 | my @output_list; |
| 1122 | my( $relPercentTol, $format, $zeroLevel, $zeroLevelTol) = @opt; |
1125 | my( $relPercentTol, $format, $zeroLevel, $zeroLevelTol) = @opt; |
| 1123 | |
1126 | |
| 1124 | unless( ref($correctAnswer) eq 'ARRAY' || scalar( @opt ) == 0 || |
1127 | unless( ref($correctAnswer) eq 'ARRAY' || scalar( @opt ) == 0 || |
| … | |
… | |
| 1459 | } |
1462 | } |
| 1460 | |
1463 | |
| 1461 | if ($corrAnswerIsString == 0 ){ # avoiding running compare_numbers when correct answer is a string. |
1464 | if ($corrAnswerIsString == 0 ){ # avoiding running compare_numbers when correct answer is a string. |
| 1462 | $answer_evaluator->install_evaluator(\&compare_numbers, %num_params); |
1465 | $answer_evaluator->install_evaluator(\&compare_numbers, %num_params); |
| 1463 | } |
1466 | } |
|
|
1467 | ############################################################################### |
|
|
1468 | # We'll leave these next lines out for now, so that the evaluated versions of the student's and professor's |
|
|
1469 | # can be displayed in the answer message. This may still cause a few anomolies when strings are used |
|
|
1470 | # |
|
|
1471 | ############################################################################### |
| 1464 | |
1472 | |
| 1465 | $answer_evaluator->install_post_filter(sub {my $rh_ans = shift; |
1473 | # $answer_evaluator->install_post_filter(sub {my $rh_ans = shift; |
| 1466 | |
1474 | # |
| 1467 | $rh_ans->{student_ans} = $rh_ans->{original_student_ans}; |
1475 | # $rh_ans->{student_ans} = $rh_ans->{original_student_ans}; |
| 1468 | $rh_ans->{correct_ans} = $rh_ans->{original_correct_ans}; |
1476 | # $rh_ans->{correct_ans} = $rh_ans->{original_correct_ans}; |
| 1469 | $rh_ans;} |
1477 | # $rh_ans;} |
| 1470 | ); |
1478 | # ); |
| 1471 | |
1479 | |
| 1472 | $answer_evaluator->install_post_filter(sub {my $rh_ans = shift; |
1480 | $answer_evaluator->install_post_filter(sub {my $rh_ans = shift; |
| 1473 | return $rh_ans unless $rh_ans->catch_error('EVAL'); |
1481 | return $rh_ans unless $rh_ans->catch_error('EVAL'); |
| 1474 | $rh_ans->{student_ans} = $rh_ans->{original_student_ans}. ' '. $rh_ans->{error_message}; |
1482 | $rh_ans->{student_ans} = $rh_ans->{original_student_ans}. ' '. $rh_ans->{error_message}; |
| 1475 | $rh_ans->clear_error('EVAL'); } ); |
1483 | $rh_ans->clear_error('EVAL'); } ); |