From: Mike G. v. a. <we...@ma...> - 2005-11-12 01:00:41
|
Log Message: ----------- Check to see if $inputs_ref->{previewAnswers} is defined. If it is then the preview button has been pressed. In this case emit a warning if the answer has been given previously regardless of whether the answer is correct or incorrect. The warning message indicates that the previous matching answer might have been either a preview or a submitted answer. Let's see how this works. Modified Files: -------------- pg/macros: PGanswermacros.pl Revision Data ------------- Index: PGanswermacros.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/PGanswermacros.pl,v retrieving revision 1.45 retrieving revision 1.46 diff -Lmacros/PGanswermacros.pl -Lmacros/PGanswermacros.pl -u -r1.45 -r1.46 --- macros/PGanswermacros.pl +++ macros/PGanswermacros.pl @@ -2036,16 +2036,18 @@ sub { my $rh_ans = shift; $rh_ans->{_filter_name} = "produce_equivalence_message"; - return $rh_ans unless $rh_ans->{prev_equals_current} && - ($rh_ans->{score} != 1 || $rh_ans->{isPreview}); - # - # If the match is exact don't give an error since there may be multiple - # entry blanks and the student is trying to get one of the other ones - # right. We should only give this message when the student is actually - # working on this answer. - # - return $rh_ans if $rh_ans->{prev_ans} eq $rh_ans->{original_student_ans}; - $rh_ans->{ans_message} = "This answer is equivalent to the one you just submitted or previewed."; + my $preview_mode_flag = $inputs_ref->{previewAnswers}; + $preview_mode_flag = defined($preview_mode_flag) and $preview_mode_flag; + # no message if no duplication + return $rh_ans unless $rh_ans->{prev_equals_current}; + + if ($preview_mode_flag) { #previews generate warning message always + $rh_ans->{ans_message} = "This answer is equivalent to the one you just submitted or previewed."; + } elsif ($rh_ans->{score} != 1) {# non correct answers generate warning message + $rh_ans->{ans_message} = "This answer is equivalent to the one you just submitted or previewed."; + } else { # correct answers in submit mode don't generate warning messages. + + } $rh_ans; } ); |