[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /homework optionresponse.pm

raeburn raeburn at source.lon-capa.org
Tue Apr 21 19:36:43 EDT 2015


raeburn		Tue Apr 21 23:36:43 2015 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/homework	optionresponse.pm 
  Log:
  - For 2.11
    Backport 1.198,  1.199.
  
  
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.195 loncom/homework/optionresponse.pm:1.195.2.1
--- loncom/homework/optionresponse.pm:1.195	Fri Nov 28 18:23:04 2014
+++ loncom/homework/optionresponse.pm	Tue Apr 21 23:36:43 2015
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.195 2014/11/28 18:23:04 raeburn Exp $
+# $Id: optionresponse.pm,v 1.195.2.1 2015/04/21 23:36:43 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -375,8 +375,8 @@
 	  }
 	}
 	my $part=$Apache::inputtags::part;
-        my $nonlenient=&grading_is_nonlenient($part);
-	my $id = $Apache::inputtags::response['-1'];
+        my $id = $Apache::inputtags::response['-1'];
+        my $nonlenient=&grading_is_nonlenient($part,$id);
 	my $responsestr=&Apache::lonnet::hash2str(%responsehash);
 	my $gradestr   =&Apache::lonnet::hash2str(%grade);
 	my %previous=&Apache::response::check_for_previous($responsestr,
@@ -491,22 +491,33 @@
 }
 
 sub grading_is_nonlenient {
-    my ($part) = @_;
+    my ($part,$id) = @_;
 # Web mode: we are non-lenient unless told otherwise
     my $defaultparm = 'off';
-    my $nonlenient = 0;
+    my $nonlenient = 1;
 # Grading a bubblesheet exam: we are grading lenient unless told otherwise
     if ($Apache::lonhomework::scantronmode) {
         $defaultparm = 'on';
-        $nonlenient = 1;
+        $nonlenient = 0;
     }
     my $lenientparm =
         &Apache::response::get_response_param($part,'lenient',$defaultparm);
+    if ($lenientparm eq 'default') {
+        $lenientparm = $defaultparm;
+    }
+    $lenientparm =
+        &Apache::response::get_response_param($part.'_'.$id,'lenient',$lenientparm);
+    if ($lenientparm eq 'default') {
+        $lenientparm = $defaultparm;
+    }
     if ($lenientparm=~/^0|off|no$/i) {
         $nonlenient = 1;
     } elsif ($lenientparm=~/^1|on|yes$/i) {
         $nonlenient = 0;
     }
+    if (!$nonlenient) {
+        $Apache::inputtags::leniency=1;
+    }
     return $nonlenient;
 }
 




More information about the LON-CAPA-cvs mailing list