| … | |
… | |
| 267 | sub cmp_postprocess { |
267 | sub cmp_postprocess { |
| 268 | my $self = shift; my $ans = shift; |
268 | my $self = shift; my $ans = shift; |
| 269 | return unless $ans->{score} == 0 && !$ans->{isPreview}; |
269 | return unless $ans->{score} == 0 && !$ans->{isPreview}; |
| 270 | if ($ans->{showDimensionHints} && |
270 | if ($ans->{showDimensionHints} && |
| 271 | $self->length != $ans->{student_value}->length) { |
271 | $self->length != $ans->{student_value}->length) { |
| 272 | $self->cmp_Error($ans,"The dimension is incorrect"); return; |
272 | $self->cmp_Error($ans,"The dimension of your result is incorrect"); return; |
| 273 | } |
273 | } |
| 274 | if ($ans->{showCoordinateHints}) { |
274 | if ($ans->{showCoordinateHints}) { |
| 275 | my @errors; |
275 | my @errors; |
| 276 | foreach my $i (1..$self->length) { |
276 | foreach my $i (1..$self->length) { |
| 277 | push(@errors,"The ".$self->NameForNumber($i)." coordinate is incorrect") |
277 | push(@errors,"The ".$self->NameForNumber($i)." coordinate is incorrect") |
| … | |
… | |
| 309 | sub cmp_postprocess { |
309 | sub cmp_postprocess { |
| 310 | my $self = shift; my $ans = shift; |
310 | my $self = shift; my $ans = shift; |
| 311 | return unless $ans->{score} == 0; |
311 | return unless $ans->{score} == 0; |
| 312 | if (!$ans->{isPreview} && $ans->{showDimensionHints} && |
312 | if (!$ans->{isPreview} && $ans->{showDimensionHints} && |
| 313 | $self->length != $ans->{student_value}->length) { |
313 | $self->length != $ans->{student_value}->length) { |
| 314 | $self->cmp_Error($ans,"The dimension is incorrect"); return; |
314 | $self->cmp_Error($ans,"The dimension of your result is incorrect"); return; |
| 315 | } |
315 | } |
| 316 | if ($ans->{parallel} && |
316 | if ($ans->{parallel} && |
| 317 | $self->isParallel($ans->{student_value},$ans->{sameDirection})) { |
317 | $self->isParallel($ans->{student_value},$ans->{sameDirection})) { |
| 318 | $ans->score(1); return; |
318 | $ans->score(1); return; |
| 319 | } |
319 | } |
| … | |
… | |
| 715 | return if $ans->{ans_message} || !$ans->{showDimensionHints}; |
715 | return if $ans->{ans_message} || !$ans->{showDimensionHints}; |
| 716 | my $other = $ans->{student_value}; |
716 | my $other = $ans->{student_value}; |
| 717 | return unless $other->type =~ m/^(Point|Vector|Matrix)$/; |
717 | return unless $other->type =~ m/^(Point|Vector|Matrix)$/; |
| 718 | return unless $self->type =~ m/^(Point|Vector|Matrix)$/; |
718 | return unless $self->type =~ m/^(Point|Vector|Matrix)$/; |
| 719 | return if Parser::Item::typeMatch($self->typeRef,$other->typeRef); |
719 | return if Parser::Item::typeMatch($self->typeRef,$other->typeRef); |
| 720 | $self->cmp_Error($ans,"The dimension is incorrect"); |
720 | $self->cmp_Error($ans,"The dimension of your result is incorrect"); |
| 721 | } |
721 | } |
| 722 | |
722 | |
| 723 | ############################################################# |
723 | ############################################################# |
| 724 | |
724 | |
| 725 | 1; |
725 | 1; |