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

raeburn raeburn at source.lon-capa.org
Tue Apr 21 08:28:05 EDT 2015


raeburn		Tue Apr 21 12:28:05 2015 EDT

  Modified files:              
    /loncom/homework	optionresponse.pm inputtags.pm structuretags.pm 
  Log:
  - Bug 2802
    If at least one response item in a problem part is set to lenient, then
    if the award for that item is ASSIGNED_SCORE, that should trump award(s)
    of INCORRECT for other response items in the same problem part, when
    finalizing the award, so "You are partially correct" will be shown, 
    unless feedback is suppressed. 
  
  
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.198 loncom/homework/optionresponse.pm:1.199
--- loncom/homework/optionresponse.pm:1.198	Mon Apr 20 21:57:47 2015
+++ loncom/homework/optionresponse.pm	Tue Apr 21 12:28:05 2015
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.198 2015/04/20 21:57:47 raeburn Exp $
+# $Id: optionresponse.pm,v 1.199 2015/04/21 12:28:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -516,6 +516,9 @@
     } elsif ($lenientparm=~/^1|on|yes$/i) {
         $nonlenient = 0;
     }
+    if (!$nonlenient) {
+        $Apache::inputtags::leniency=1;
+    }
     return $nonlenient;
 }
 
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.333 loncom/homework/inputtags.pm:1.334
--- loncom/homework/inputtags.pm:1.333	Wed Mar 18 12:53:24 2015
+++ loncom/homework/inputtags.pm	Tue Apr 21 12:28:05 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.333 2015/03/18 12:53:24 raeburn Exp $
+# $Id: inputtags.pm,v 1.334 2015/04/21 12:28:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -996,6 +996,23 @@
 	$j++;
     }
 
+    # if at least one response item is set to include lenient grading
+    # and that item is partially correct then overall award reflects
+    # that, unless an award for one of the other response items does
+    # not fall within the basic awards for correct or incorrect.
+    if ($Apache::inputtags::leniency) {
+        if (($$awardref[$which] eq 'INCORRECT')
+            && (grep { $_ eq 'EXACT_ANS' ||
+                       $_ eq 'APPROX_ANS' ||
+                       $_ eq 'ASSIGNED_SCORE' } (@$awardref))
+            && !((grep { $_ ne 'INCORRECT' &&
+                         $_ ne 'EXACT_ANS' &&
+                         $_ ne 'APPROX_ANS' &&
+                         $_ ne 'ASSIGNED_SCORE' } (@$awardref)))) {
+            return ('ASSIGNED_SCORE');
+        }
+    }
+
     if (defined($which)) {
 	if (ref($nameref)) {
 	    return ($$awardref[$which],$$msgref[$which],$$nameref[$which]);
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.535 loncom/homework/structuretags.pm:1.536
--- loncom/homework/structuretags.pm:1.535	Fri Apr 17 12:33:56 2015
+++ loncom/homework/structuretags.pm	Tue Apr 21 12:28:05 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.535 2015/04/17 12:33:56 droeschl Exp $
+# $Id: structuretags.pm,v 1.536 2015/04/21 12:28:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1388,6 +1388,7 @@
     @Apache::inputtags::importlist = ();
     @Apache::inputtags::previous=();
     @Apache::inputtags::previous_version=();
+    $Apache::inputtags::leniency='';
     $Apache::structuretags::printanswer='No';
     @Apache::structuretags::whileconds=();
     @Apache::structuretags::whilebody=();
@@ -1403,6 +1404,7 @@
     undef(%Apache::lonhomework::history);
     undef(%Apache::lonhomework::results);
     undef($Apache::inputtags::part);
+    undef($Apache::inputtags::leniency);
     if ($type eq 'Task') {
         undef($Apache::inputtags::slot_name);
     } elsif ($type eq 'problem') {
@@ -2606,6 +2608,7 @@
     my $id= &Apache::lonxml::get_id($parstack,$safeeval);
     $Apache::inputtags::part=$id;
     push(@Apache::inputtags::partlist,$id);
+    $Apache::inputtags::leniency='';
     @Apache::inputtags::response=();
     @Apache::inputtags::previous=();
     @Apache::inputtags::previous_version=();
@@ -2771,6 +2774,7 @@
     }
     pop @Apache::inputtags::status;
     $Apache::inputtags::part='';
+    $Apache::inputtags::leniency='';
     $Apache::lonhomework::type = $Apache::lonhomework::default_type;
     return $result;
 }




More information about the LON-CAPA-cvs mailing list