| … | |
… | |
| 76 | $self->cmp_defaults(@_), |
76 | $self->cmp_defaults(@_), |
| 77 | %{$self->{context}{cmpDefaults}{$self->class} || {}}, # context-specified defaults |
77 | %{$self->{context}{cmpDefaults}{$self->class} || {}}, # context-specified defaults |
| 78 | @_ |
78 | @_ |
| 79 | ); |
79 | ); |
| 80 | $ans->{debug} = $ans->{rh_ans}{debug}; |
80 | $ans->{debug} = $ans->{rh_ans}{debug}; |
| 81 | $ans->install_evaluator(sub {$ans = shift; $ans->{correct_value}->cmp_parse($ans)}); |
81 | $ans->install_evaluator(sub { |
|
|
82 | $ans = shift; |
|
|
83 | $ans->{_filter_name} = "MathObjects answer checker"; |
|
|
84 | $ans->{correct_value}->cmp_parse($ans); |
|
|
85 | }); |
| 82 | $ans->install_pre_filter('erase') if $self->{ans_name}; # don't do blank check if answer_array |
86 | $ans->install_pre_filter('erase') if $self->{ans_name}; # don't do blank check if answer_array |
| 83 | $self->cmp_diagnostics($ans); |
87 | $self->cmp_diagnostics($ans); |
| 84 | return $ans; |
88 | return $ans; |
| 85 | } |
89 | } |
| 86 | |
90 | |
| … | |
… | |
| 195 | my $correct = $ans->{correct_value}; |
199 | my $correct = $ans->{correct_value}; |
| 196 | my $student = $ans->{student_value}; |
200 | my $student = $ans->{student_value}; |
| 197 | if ($correct->typeMatch($student,$ans)) { |
201 | if ($correct->typeMatch($student,$ans)) { |
| 198 | $self->context->clearError(); |
202 | $self->context->clearError(); |
| 199 | my $equal = $correct->cmp_compare($student,$ans); |
203 | my $equal = $correct->cmp_compare($student,$ans); |
| 200 | if ($self->context->{error}{flag} != $CMP_MESSAGE && |
204 | if ($self->context->{error}{flag} != $CMP_MESSAGE && |
| 201 | (defined($equal) || !$ans->{showEqualErrors})) {$ans->score(1) if $equal; return} |
205 | (defined($equal) || !$ans->{showEqualErrors})) {$ans->score(1) if $equal; return} |
| 202 | $self->cmp_error($ans); |
206 | $self->cmp_error($ans); |
| 203 | } else { |
207 | } else { |
| 204 | return if $ans->{ignoreStrings} && (!Value::isValue($student) || $student->type eq 'String'); |
208 | return if $ans->{ignoreStrings} && (!Value::isValue($student) || $student->type eq 'String'); |
| 205 | $ans->{typeError} = 1; |
209 | $ans->{typeError} = 1; |