[system] / trunk / webwork / system / courseScripts / AnswerHash.pm Repository:
ViewVC logotype

Diff of /trunk/webwork/system/courseScripts/AnswerHash.pm

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

Revision 187 Revision 188
251 $rh_ans; 251 $rh_ans;
252} 252}
253 253
254sub get_student_answer { 254sub get_student_answer {
255 my $self = shift; 255 my $self = shift;
256 my $input = shift; 256 my $input = shift;
257 $input = '' unless defined($input);
257 if (ref($input) =~/AnswerHash/) { 258 if (ref($input) =~/AnswerHash/) {
258 # in this case nothing needs to be done, since the student's answer is already in an answerhash. 259 # in this case nothing needs to be done, since the student's answer is already in an answerhash.
259 # This is useful when an AnswerEvaluator is used as a filter in another answer evaluator. 260 # This is useful when an AnswerEvaluator is used as a filter in another answer evaluator.
260 } elsif ($input =~ /\0/ ) { 261 } elsif ($input =~ /\0/ ) { # this case may occur with older versions of CGI??
261 my @input = split(/\0/,$input); 262 my @input = split(/\0/,$input);
262 $self-> {rh_ans} -> {original_student_ans} = " ( " .join(", ",@input) . " ) "; 263 $self-> {rh_ans} -> {original_student_ans} = " ( " .join(", ",@input) . " ) ";
263 $input = \@input; 264 $input = \@input;
264 $self-> {rh_ans} -> {student_ans} = $input; 265 $self-> {rh_ans} -> {student_ans} = $input;
266 } elsif (ref($input) eq 'ARRAY' ) { # sometimes the answer may already be decoded into an array.
267 my @input = @$input;
268 $self-> {rh_ans} -> {original_student_ans} = " ( " .join(", ",@input) . " ) ";
269 $input = \@input;
270 $self-> {rh_ans} -> {student_ans} = $input;
265 } else { 271 } else {
266 $input = '' unless defined($input); 272
267 $self-> {rh_ans} -> {original_student_ans} = $input; 273 $self-> {rh_ans} -> {original_student_ans} = $input;
268 $self-> {rh_ans} -> {student_ans} = $input; 274 $self-> {rh_ans} -> {student_ans} = $input;
269 } 275 }
270 276
271 277

Legend:
Removed from v.187  
changed lines
  Added in v.188

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9