[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm lonhomework.pm matchresponse.pm optionresponse.pm response.pm /homework/templates custompartial.problem /interface lonparmset.pm /misc releaseslist.xml /publisher packages.tab

raeburn raeburn at source.lon-capa.org
Wed Dec 14 20:21:46 EST 2011


raeburn		Thu Dec 15 01:21:46 2011 EDT

  Modified files:              
    /loncom/homework	inputtags.pm lonhomework.pm response.pm 
                    	matchresponse.pm optionresponse.pm 
    /loncom/misc	releaseslist.xml 
    /loncom/publisher	packages.tab 
    /loncom/interface	lonparmset.pm 
    /loncom/homework/templates	custompartial.problem 
  Log:
  - Bug 2802.
    - Separate decision on leniency in grading from logic on whether additional
      new submission is possible for partially correct problem parts.
    - new parameter: retrypartial set to "yes" if part is to be answerable
      when partially correct.
    - custompartial.problem template incorporates retrypartial parameter in
      place of lenient parameter.
    - points awarded > 1 no longer considered 'partially correct'.
    - &grading_is_nonlenient() moved from inputtags.pm back to optionresponse.pm
  
  
-------------- next part --------------
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.298 loncom/homework/inputtags.pm:1.299
--- loncom/homework/inputtags.pm:1.298	Sat Dec 10 18:10:56 2011
+++ loncom/homework/inputtags.pm	Thu Dec 15 01:21:28 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.298 2011/12/10 18:10:56 www Exp $
+# $Id: inputtags.pm,v 1.299 2011/12/15 01:21:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -843,26 +843,6 @@
 }
 }
 
-sub grading_is_nonlenient {
-    my ($part) = @_;
-# Web mode: we are non-lenient unless told otherwise
-    my $defaultparm = 'off';
-    my $nonlenient = 0;
-# Grading a bubblesheet exam: we are grading lenient unless told otherwise
-    if ($Apache::lonhomework::scantronmode) {
-        $defaultparm = 'on';
-        $nonlenient = 1;
-    }
-    my $lenientparm =
-        &Apache::response::get_response_param($part,'lenient',$defaultparm);
-    if ($lenientparm=~/^0|off|no$/i) {
-        $nonlenient = 1;
-    } elsif ($lenientparm=~/^1|on|yes$/i) {
-        $nonlenient = 0;
-    }
-    return $nonlenient;
-}
-
 sub decideoutput {
     my ($award,$awarded,$awardmsg,$solved,$previous,$target,$nocorrect)=@_;
 
@@ -931,11 +911,11 @@
 		}
 	    }
 	}
-        if (&grading_is_nonlenient($part)) {
+        if ($awarded >= 1) {
             $button=0;
-        } elsif ($awarded==1) {
+        } elsif (&Apache::lonnet::EXT("resource.$part.retrypartial") !~/^1|on|yes$/i) {
             $button=0;
-        } else { 
+        } else {
             $button=1;
         }
 	$previousmsg='';
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.332 loncom/homework/lonhomework.pm:1.333
--- loncom/homework/lonhomework.pm:1.332	Thu Dec  8 01:34:47 2011
+++ loncom/homework/lonhomework.pm	Thu Dec 15 01:21:28 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.332 2011/12/08 01:34:47 www Exp $
+# $Id: lonhomework.pm,v 1.333 2011/12/15 01:21:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -444,8 +444,8 @@
 	# if (correct and show prob status) or excused then CANNOT_ANSWER
 	if ( ($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/)
 	      && (&show_problem_status()) ) {
-            if (&Apache::inputtags::grading_is_nonlenient($id) || 
-                $Apache::lonhomework::history{"resource.$id.awarded"} == 1) {
+            if (($Apache::lonhomework::history{"resource.$id.awarded"} >= 1) ||
+                (&Apache::lonnet::EXT("resource.$id.retrypartial") !~/^1|on|yes$/i)) {
 	        $status = 'CANNOT_ANSWER';
             }
         } elsif ($Apache::lonhomework::history{"resource.$id.solved"}=~/^excused/) {
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.229 loncom/homework/response.pm:1.230
--- loncom/homework/response.pm:1.229	Tue Nov 29 17:43:30 2011
+++ loncom/homework/response.pm	Thu Dec 15 01:21:28 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.229 2011/11/29 17:43:30 raeburn Exp $
+# $Id: response.pm,v 1.230 2011/12/15 01:21:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1189,8 +1189,8 @@
     my $status = $Apache::inputtags::status[-1];
     my $canshow = 0;
     if ($award =~ /^correct/) {
-        if ((&Apache::inputtags::grading_is_nonlenient($part)) ||
-            ($Apache::lonhomework::history{"resource.$part.awarded"} == 1)) {
+        if (($Apache::lonhomework::history{"resource.$part.awarded"} >= 1) ||
+            (&Apache::lonnet::EXT("resource.$part.retrypartial") !~/^1|on|yes$/)) {
             $canshow = 1;
         }   
     }
Index: loncom/homework/matchresponse.pm
diff -u loncom/homework/matchresponse.pm:1.85 loncom/homework/matchresponse.pm:1.86
--- loncom/homework/matchresponse.pm:1.85	Tue Nov 29 13:24:38 2011
+++ loncom/homework/matchresponse.pm	Thu Dec 15 01:21:28 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Full matching style response
 #
-# $Id: matchresponse.pm,v 1.85 2011/11/29 13:24:38 raeburn Exp $
+# $Id: matchresponse.pm,v 1.86 2011/12/15 01:21:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -30,7 +30,6 @@
 use strict;
 use HTML::Entities();
 use Math::Random();
-use Apache::inputtags();
 use Apache::optionresponse();
 use Apache::lonlocal;
 use Apache::lonnet;
@@ -463,7 +462,7 @@
 	}
     }
     my $part=$Apache::inputtags::part;
-    my $nonlenient=&Apache::inputtags::grading_is_nonlenient($part);
+    my $nonlenient=&Apache::optionresponse::grading_is_nonlenient($part);
     my $id = $Apache::inputtags::response['-1'];
     my $responsestr=&Apache::lonnet::hash2str(%responsehash);
     my $itemstr    =&Apache::lonnet::array2str(@items);
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.183 loncom/homework/optionresponse.pm:1.184
--- loncom/homework/optionresponse.pm:1.183	Tue Nov 29 13:24:38 2011
+++ loncom/homework/optionresponse.pm	Thu Dec 15 01:21:28 2011
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.183 2011/11/29 13:24:38 raeburn Exp $
+# $Id: optionresponse.pm,v 1.184 2011/12/15 01:21:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -32,7 +32,6 @@
 
 package Apache::optionresponse;
 use strict;
-use Apache::inputtags();
 use Apache::response();
 use Apache::lonlocal;
 use Apache::lonnet;
@@ -283,7 +282,7 @@
 	  }
 	}
 	my $part=$Apache::inputtags::part;
-        my $nonlenient=&Apache::inputtags::grading_is_nonlenient($part);
+        my $nonlenient=&grading_is_nonlenient($part);
 	my $id = $Apache::inputtags::response['-1'];
 	my $responsestr=&Apache::lonnet::hash2str(%responsehash);
 	my $gradestr   =&Apache::lonnet::hash2str(%grade);
@@ -387,6 +386,26 @@
   return $result;
 }
 
+sub grading_is_nonlenient {
+    my ($part) = @_;
+# Web mode: we are non-lenient unless told otherwise
+    my $defaultparm = 'off';
+    my $nonlenient = 0;
+# Grading a bubblesheet exam: we are grading lenient unless told otherwise
+    if ($Apache::lonhomework::scantronmode) {
+        $defaultparm = 'on';
+        $nonlenient = 1;
+    }
+    my $lenientparm =
+        &Apache::response::get_response_param($part,'lenient',$defaultparm);
+    if ($lenientparm=~/^0|off|no$/i) {
+        $nonlenient = 1;
+    } elsif ($lenientparm=~/^1|on|yes$/i) {
+        $nonlenient = 0;
+    }
+    return $nonlenient;
+}
+
 sub getfoilcounts {
   my ($max)=@_;
   # +1 since instructors will count from 1
Index: loncom/misc/releaseslist.xml
diff -u loncom/misc/releaseslist.xml:1.4 loncom/misc/releaseslist.xml:1.5
--- loncom/misc/releaseslist.xml:1.4	Sat Oct  8 01:52:55 2011
+++ loncom/misc/releaseslist.xml	Thu Dec 15 01:21:32 2011
@@ -6,6 +6,7 @@
 <parameter name="type" value="practice">2.2</parameter>
 <parameter name="lenient" value="yes">2.11</parameter>
 <parameter name="lenient" value="no">2.11</parameter>
+<parameter name="retrypartial" value="yes">2.11</parameter>
 <resourcetag name="responsetype" value="custom">2.1</resourcetag>
 <resourcetag name="responsetype" value="math">2.2</resourcetag>
 <resourcetag name="responsetype" value="functionplot">2.10</resourcetag>
Index: loncom/publisher/packages.tab
diff -u loncom/publisher/packages.tab:1.68 loncom/publisher/packages.tab:1.69
--- loncom/publisher/packages.tab:1.68	Sat Oct  8 19:03:00 2011
+++ loncom/publisher/packages.tab	Thu Dec 15 01:21:37 2011
@@ -35,6 +35,9 @@
 part&ordered&type:string_yesno
 part&ordered&default:no
 part&ordered&display:Show Parts One-at-a-Time
+part&retrypartial&display:Partially correct is answerable 
+part&retrypartial&type:string_yesno
+part&retrypartial&default:no
 part_0&useslots&display:Use slot based access controls
 part_0&useslots&type:string_useslots
 part_0&useslots&default:no
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.518 loncom/interface/lonparmset.pm:1.519
--- loncom/interface/lonparmset.pm:1.518	Thu Dec  8 21:37:46 2011
+++ loncom/interface/lonparmset.pm	Thu Dec 15 01:21:41 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.518 2011/12/08 21:37:46 www Exp $
+# $Id: lonparmset.pm,v 1.519 2011/12/15 01:21:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1394,6 +1394,7 @@
         'maxcollaborators' => 'misc',
         'scoreformat' => 'misc',
         'lenient' => 'grading',
+        'retrypartial' => 'tries',
 
     );    
 }
@@ -2145,7 +2146,7 @@
                         }
                     }
                 }
-            } elsif ($markers[$i] =~ /_(type|lenient)\&\d+$/) {
+            } elsif ($markers[$i] =~ /_(type|lenient|retrypartial)\&\d+$/) {
                 $name = $1;
                 $needsrelease =
                     $Apache::lonnet::needsrelease{"parameter:$name:$values[$i]"};
@@ -2807,6 +2808,10 @@
                 $name = 'type';
             } elsif ($typeof eq 'string_lenient') {
                 $name = 'lenient';
+            } elsif ($typeof eq 'string_yesno') {
+                if ($thiskey =~ /\.retrypartial$/) {
+                    $name = 'retrypartial';
+                }
             }
             if ($name ne '') {
                 my ($needsrelease,$needsnewer);
@@ -3155,7 +3160,8 @@
 
     my %skiptype;
     if (($thistype eq 'string_questiontype') || 
-        ($thistype eq 'string_lenient')) {
+        ($thistype eq 'string_lenient') ||
+        ($name eq 'retrypartial')) {
         my ($got_chostname,$chostname,$cmajor,$cminor); 
         foreach my $possibilities (@{ $strings{$thistype} }) {
             next unless (ref($possibilities) eq 'ARRAY');
@@ -4606,8 +4612,9 @@
     my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_;
     my $desc;
     my %stringtypes = (
-                        type    => 'string_questiontype',
-                        lenient => 'string_lenient'
+                        type         => 'string_questiontype',
+                        lenient      => 'string_lenient',
+                        retrypartial => 'string_yesno',
                       );
     if (exists($stringtypes{$name})) {
         if (ref($strings{$stringtypes{$name}}) eq 'ARRAY') {
Index: loncom/homework/templates/custompartial.problem
diff -u loncom/homework/templates/custompartial.problem:1.3 loncom/homework/templates/custompartial.problem:1.4
--- loncom/homework/templates/custompartial.problem:1.3	Tue Nov 29 13:24:41 2011
+++ loncom/homework/templates/custompartial.problem	Thu Dec 15 01:21:45 2011
@@ -1,5 +1,5 @@
 <problem>
- <parameter name="lenient" type="string_lenient" description="Lenient Grading (Partial Credit)" default="yes" />
+ <parameter name="lenient" type="string_yesno" description="Partially correct is answerable" default="yes" />
 
 <startouttext />
 Complete the sentence:


More information about the LON-CAPA-cvs mailing list