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

raeburn raeburn at source.lon-capa.org
Mon Apr 20 17:57:47 EDT 2015


raeburn		Mon Apr 20 21:57:47 2015 EDT

  Modified files:              
    /loncom/homework	optionresponse.pm 
  Log:
  - Bug 2802
    Support different settings for the lenient parameter for each part in a
    multi-part problem.
  
  
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.197 loncom/homework/optionresponse.pm:1.198
--- loncom/homework/optionresponse.pm:1.197	Thu Apr  9 09:48:02 2015
+++ loncom/homework/optionresponse.pm	Mon Apr 20 21:57:47 2015
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.197 2015/04/09 09:48:02 droeschl Exp $
+# $Id: optionresponse.pm,v 1.198 2015/04/20 21:57:47 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -376,8 +376,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,
@@ -492,17 +492,25 @@
 }
 
 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) {




More information about the LON-CAPA-cvs mailing list