[system] / trunk / pg / macros / PGanswermacros.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/PGanswermacros.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1811 Revision 1812
1103 my ($in, $formattedSubmittedAnswer); 1103 my ($in, $formattedSubmittedAnswer);
1104 $answer_evaluator->install_pre_filter(sub {my $rh_ans = shift; 1104 $answer_evaluator->install_pre_filter(sub {my $rh_ans = shift;
1105 $rh_ans->{original_student_ans} = $rh_ans->{student_ans}; $rh_ans;} 1105 $rh_ans->{original_student_ans} = $rh_ans->{student_ans}; $rh_ans;}
1106 ); 1106 );
1107 1107
1108 $answer_evaluator->install_pre_filter(\&check_syntax); 1108
1109 1109
1110 if (defined($num_params{units}) && $num_params{units}) { 1110 if (defined($num_params{units}) && $num_params{units}) {
1111 $answer_evaluator->install_pre_filter(\&check_units); 1111 $answer_evaluator->install_pre_filter(\&check_units);
1112 } 1112 }
1113 if (defined($num_params{strings}) && $num_params{strings}) { 1113 if (defined($num_params{strings}) && $num_params{strings}) {
1114 $answer_evaluator->install_pre_filter(\&check_strings, %num_params); 1114 $answer_evaluator->install_pre_filter(\&check_strings, %num_params);
1115 } 1115 }
1116 1116
1117 ## FIXME? - this pre filter was moved before check_units to allow 1117 ## FIXME? - this pre filter was moved before check_units to allow
1118 ## for latex preview of answers with no units. 1118 ## for latex preview of answers with no units.
1119 ## seems to work but may have unintended side effects elsewhere. 1119 ## seems to work but may have unintended side effects elsewhere.
1120
1121 ## Actually it caused trouble with the check strings package so it has been moved back
1122 # We'll try some other method -- perhaps add code to fix_answer for display
1120 #$answer_evaluator->install_pre_filter(\&check_syntax); 1123 $answer_evaluator->install_pre_filter(\&check_syntax);
1121 1124
1122 $answer_evaluator->install_pre_filter(\&math_constants); 1125 $answer_evaluator->install_pre_filter(\&math_constants);
1123 1126
1124 if ($mode eq 'std') { 1127 if ($mode eq 'std') {
1125 # do nothing 1128 # do nothing
3319 if ( $rh_ans->{answerIsString} ==1) { 3322 if ( $rh_ans->{answerIsString} ==1) {
3320 $rh_ans = evaluatesToNumber ($rh_ans, %options); 3323 $rh_ans = evaluatesToNumber ($rh_ans, %options);
3321 } 3324 }
3322 if (defined ($rh_ans->{student_units})) { 3325 if (defined ($rh_ans->{student_units})) {
3323 $rh_ans->{student_ans} = $rh_ans->{student_ans}. ' '. $rh_ans->{student_units}; 3326 $rh_ans->{student_ans} = $rh_ans->{student_ans}. ' '. $rh_ans->{student_units};
3327
3328 }
3329 if ( $rh_ans->catch_error('UNITS') ) { # create preview latex string for expressions even if the units are incorrect
3330 my $rh_temp = new AnswerHash;
3331 $rh_temp->{student_ans} = $rh_ans->{student_ans};
3332 $rh_temp = check_syntax($rh_temp);
3333 $rh_ans->{preview_latex_string} = $rh_temp->{preview_latex_string};
3324 } 3334 }
3325 $rh_ans->{correct_ans} = $rh_ans->{original_correct_ans}; 3335 $rh_ans->{correct_ans} = $rh_ans->{original_correct_ans};
3326 3336
3327 $rh_ans; 3337 $rh_ans;
3328} 3338}

Legend:
Removed from v.1811  
changed lines
  Added in v.1812

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9