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

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

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

Revision 5328 Revision 5365
121 },@_); 121 },@_);
122} 122}
123 123
124package AnswerHints; 124package AnswerHints;
125 125
126my $noValueRef = ! defined &{\&{Value::Ref}};
127# 126#
128# Calls the answer checker on two values with a copy of the answer hash 127# Calls the answer checker on two values with a copy of the answer hash
129# and returns true if the two values match and false otherwise. 128# and returns true if the two values match and false otherwise.
130# 129#
131sub Compare { 130sub Compare {
132 my $self = shift; my $other = shift; my $ans = shift; 131 my $self = shift; my $other = shift; my $ans = shift;
133 $ans = bless {%{$ans},@_}, ref($ans); # make a copy 132 $ans = bless {%{$ans},@_}, ref($ans); # make a copy
134 $ans->{typeError} = 0; $ans->{ans_message} = $ans->{error_message} = ""; $ans->{score} = 0; 133 $ans->{typeError} = 0; $ans->{ans_message} = $ans->{error_message} = ""; $ans->{score} = 0;
135 if ($noValueRef || Value::Ref($self) != Value::Ref($ans->{correct_value})) { 134 if (sprintf("%p",$self) ne sprintf("%p",$ans->{correct_value})) {
136 $ans->{correct_ans} = $self->string; 135 $ans->{correct_ans} = $self->string;
137 $ans->{correct_value} = $self; 136 $ans->{correct_value} = $self;
138 $ans->{correct_formula} = Value->Package("Formula")->new($self); 137 $ans->{correct_formula} = Value->Package("Formula")->new($self);
139 } 138 }
140 if ($noValueRef || Value::Ref($other) != Value::Ref($ans->{student_value})) { 139 if (sprintf("%p",$other) ne sprintf("%p",$ans->{student_value})) {
141 $ans->{student_ans} = $other->string; 140 $ans->{student_ans} = $other->string;
142 $ans->{student_value} = $other; 141 $ans->{student_value} = $other;
143 $ans->{student_formula} = Value->Package("Formula")->new($other); 142 $ans->{student_formula} = Value->Package("Formula")->new($other);
144 } 143 }
145 $self->cmp_preprocess($ans); 144 $self->cmp_preprocess($ans);

Legend:
Removed from v.5328  
changed lines
  Added in v.5365

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9