--- loncom/homework/inputtags.pm 2004/07/15 19:44:54 1.148 +++ loncom/homework/inputtags.pm 2004/11/06 01:15:59 1.149.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.148 2004/07/15 19:44:54 albertel Exp $ +# $Id: inputtags.pm,v 1.149.2.1 2004/11/06 01:15:59 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -348,7 +348,7 @@ sub decideoutput { } else { $message = "".&mt('You are correct.').""; } - $message.=" ".&mt("Computer's answer now shown."); + $message.=" ".&mt("Computer's answer now shown above."); $added_computer_text=1; unless ($ENV{'course.'. $ENV{'request.course.id'}. @@ -381,7 +381,7 @@ sub decideoutput { } else { $message = "".&mt('You are correct.').""; } - $message.=" ".&mt("Computer's answer now shown."); + $message.=" ".&mt("Computer's answer now shown above."); $added_computer_text=1; unless ($ENV{'course.'. $ENV{'request.course.id'}. @@ -492,7 +492,7 @@ sub decideoutput { } if ($Apache::inputtags::status[-1] eq 'SHOW_ANSWER' && !$added_computer_text) { - $message.=" ".&mt("Computer's answer now shown."); + $message.=" ".&mt("Computer's answer now shown above."); $added_computer_text=1; } return ($button,$bgcolor,$message,$previousmsg); @@ -524,10 +524,15 @@ sub hidealldata { sub setgradedata { my ($award,$msg,$id,$previously_used) = @_; - # if the student already has it correct, don't modify the status - if ($Apache::lonhomework::scantronmode && defined($ENV{'form.CODE'})) { + if ($Apache::lonhomework::scantronmode && + &Apache::lonnet::validCODE($ENV{'form.CODE'})) { $Apache::lonhomework::results{"resource.CODE"}=$ENV{'form.CODE'}; + } elsif ($Apache::lonhomework::scantronmode && + $ENV{'form.CODE'} eq '' && + $Apache::lonhomework::history{"resource.CODE"} ne '') { + $Apache::lonhomework::results{"resource.CODE"}=''; } + if (!$Apache::lonhomework::scantronmode && $Apache::inputtags::status['-1'] ne 'CAN_ANSWER' && $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') { @@ -536,7 +541,10 @@ sub setgradedata { } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~ /^correct/ || $Apache::lonhomework::scantronmode || lc($Apache::lonhomework::problemstatus) eq 'no') { - #handle assignment of tries and solved status + # the student doesn't already have it correct, + # or we are in a mode (scantron orno problem status) where a correct + # can become incorrect + # handle assignment of tries and solved status my $solvemsg; if ($Apache::lonhomework::scantronmode) { $solvemsg='correct_by_scantron';