--- loncom/homework/optionresponse.pm 2010/12/19 00:52:00 1.173 +++ loncom/homework/optionresponse.pm 2011/03/07 19:42:21 1.175 @@ -1,7 +1,7 @@ # LearningOnline Network with CAPA # option list style responses # -# $Id: optionresponse.pm,v 1.173 2010/12/19 00:52:00 raeburn Exp $ +# $Id: optionresponse.pm,v 1.175 2011/03/07 19:42:21 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -225,7 +225,26 @@ sub end_foilgroup { my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]"; push (@{ $Apache::lonhomework::analyze{"$part_id.options"} },@opt); } elsif ( $target eq 'grade') { + + my $nonlenient=0; + my $part=$Apache::inputtags::part; + my $lenientparm=&Apache::lonnet::EXT("resource.$part.lenient"); + + if ($Apache::lonhomework::scantronmode) { + $nonlenient=0; +# Grading an exam: we are grading lenient unless told not to + if ($lenientparm=~/^0|off|no$/i) { + $nonlenient=1; + } + } else { +# Web mode: we are non-lenient unless told to + $nonlenient=1; + if ($lenientparm=~/^1|on|yes$/i) { + $nonlenient=0; + } + } if ( &Apache::response::submitted()) { + my @whichopt = &whichfoils($max,$randomize); my $temp=1;my $name; my %responsehash; @@ -286,7 +305,10 @@ sub end_foilgroup { my $ad=$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}='MISSING_ANSWER'; &Apache::response::handle_previous(\%previous,$ad); } - } elsif (!$Apache::lonhomework::scantronmode) { + } elsif ($nonlenient) { +# +# Non-lenient mode. All right or all wrong +# my $ad; if ($wrong==0 && $ignored==0) { $ad='EXACT_ANS'; @@ -302,6 +324,9 @@ sub end_foilgroup { $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$ad; &Apache::response::handle_previous(\%previous,$ad); } else { +# +# This is lenient mode +# my $ad; if ($wrong==0 && $right==0) { #nothing submitted only assign a score if we @@ -435,7 +460,6 @@ sub displayfoils { my $part=$Apache::inputtags::part; my $id=$Apache::inputtags::response[-1]; my $break; - my $solved=$Apache::lonhomework::history{"resource.$part.solved"}; if ( ($target ne 'tex') && &Apache::response::show_answer() ) { my $temp=1;