[LON-CAPA-cvs] cvs: loncom /homework optionresponse.pm /publisher packages.tab

www www@source.lon-capa.org
Thu, 03 Mar 2011 21:05:38 -0000


www		Thu Mar  3 21:05:38 2011 EDT

  Modified files:              
    /loncom/homework	optionresponse.pm 
    /loncom/publisher	packages.tab 
  Log:
  Work in progress on lenient option response grading
  
  
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.173 loncom/homework/optionresponse.pm:1.174
--- loncom/homework/optionresponse.pm:1.173	Sun Dec 19 00:52:00 2010
+++ loncom/homework/optionresponse.pm	Thu Mar  3 21:05:35 2011
@@ -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.174 2011/03/03 21:05:35 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -225,6 +225,26 @@
 	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");
+
+      &Apache::lonnet::logthis("Parameter ".$part." ".$lenientparm);
+
+      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;
+         }
+      }
+      &Apache::lonnet::logthis("Non-Lenient set to ".$nonlenient);
       if ( &Apache::response::submitted()) {
 	my @whichopt = &whichfoils($max,$randomize);
 	my $temp=1;my $name;
@@ -286,7 +306,11 @@
 		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
+#
+            &Apache::lonnet::logthis("In non-lenient");
 	    my $ad;
 	    if ($wrong==0 && $ignored==0) {
 		$ad='EXACT_ANS';
@@ -302,6 +326,10 @@
 	    $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$ad;
 	    &Apache::response::handle_previous(\%previous,$ad);
 	} else {
+#
+# This is lenient mode
+#
+            &Apache::lonnet::logthis("This is in lenient mode ... nice");
 	    my $ad;
 	    if ($wrong==0 && $right==0) {
 		#nothing submitted only assign a score if we 
Index: loncom/publisher/packages.tab
diff -u loncom/publisher/packages.tab:1.62 loncom/publisher/packages.tab:1.63
--- loncom/publisher/packages.tab:1.62	Sat Dec 18 23:18:45 2010
+++ loncom/publisher/packages.tab	Thu Mar  3 21:05:38 2011
@@ -93,6 +93,9 @@
 mathresponse&turnoffeditor&type:string_yesno
 mathresponse&turnoffeditor&default:no
 mathresponse&turnoffeditor&display:Hide DragMath-Editor
+optionresponse&lenient&type:string
+optionresponse&lenient&default:default
+optionresponse&lenient&display:Lenient Grading (Partial Credit)
 
 #parameters for things by extension
 extension_sequence&encrypturl&type:string_yesno