| … | |
… | |
| 2034 | # |
2034 | # |
| 2035 | $cmp->install_post_filter( |
2035 | $cmp->install_post_filter( |
| 2036 | sub { |
2036 | sub { |
| 2037 | my $rh_ans = shift; |
2037 | my $rh_ans = shift; |
| 2038 | $rh_ans->{_filter_name} = "produce_equivalence_message"; |
2038 | $rh_ans->{_filter_name} = "produce_equivalence_message"; |
| 2039 | my $preview_mode_flag = $inputs_ref->{previewAnswers}; |
|
|
| 2040 | $preview_mode_flag = defined($preview_mode_flag) and $preview_mode_flag; |
|
|
| 2041 | # no message if no duplication |
|
|
| 2042 | return $rh_ans unless $rh_ans->{prev_equals_current}; |
2039 | return $rh_ans unless $rh_ans->{prev_equals_current} && |
|
|
2040 | ($rh_ans->{score} != 1 || $rh_ans->{isPreview}); |
| 2043 | |
2041 | # |
| 2044 | if ($preview_mode_flag) { #previews generate warning message always |
2042 | # If the match is exact don't give an error since there may be multiple |
|
|
2043 | # entry blanks and the student is trying to get one of the other ones |
|
|
2044 | # right. We should only give this message when the student is actually |
|
|
2045 | # working on this answer. |
|
|
2046 | # |
|
|
2047 | return $rh_ans if $rh_ans->{prev_ans} eq $rh_ans->{original_student_ans}; |
| 2045 | $rh_ans->{ans_message} = "This answer is equivalent to the one you just submitted or previewed."; |
2048 | $rh_ans->{ans_message} = "This answer is equivalent to the one you just submitted or previewed."; |
| 2046 | } elsif ($rh_ans->{score} != 1) {# non correct answers generate warning message |
|
|
| 2047 | $rh_ans->{ans_message} = "This answer is equivalent to the one you just submitted or previewed."; |
|
|
| 2048 | } else { # correct answers in submit mode don't generate warning messages. |
|
|
| 2049 | |
|
|
| 2050 | } |
|
|
| 2051 | $rh_ans; |
2049 | $rh_ans; |
| 2052 | } |
2050 | } |
| 2053 | ); |
2051 | ); |
| 2054 | |
2052 | |
| 2055 | return $cmp; |
2053 | return $cmp; |