[LON-CAPA-cvs] cvs: loncom /homework grades.pm /xml lonxml.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 25 Jun 2008 12:00:38 -0000


raeburn		Wed Jun 25 08:00:38 2008 EDT

  Modified files:              
    /loncom/homework	grades.pm 
    /loncom/xml	lonxml.pm 
  Log:
  Bug 5695.
  Improved fix.  Earlier fix caused other things to break (e.g., scantron grading). Now explicitly pass a grade_noincrement form element in the ssi call to inhibit the unwanted second increment of the counter when displaying submission details ("by datess and submissions" case only).
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.524 loncom/homework/grades.pm:1.525
--- loncom/homework/grades.pm:1.524	Tue Jun 24 14:54:36 2008
+++ loncom/homework/grades.pm	Wed Jun 25 07:59:59 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.524 2008/06/24 18:54:36 raeburn Exp $
+# $Id: grades.pm,v 1.525 2008/06/25 11:59:59 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -278,7 +278,7 @@
     }
 
     sub get_analyze {
-	my ($symb,$uname,$udom)=@_;
+	my ($symb,$uname,$udom,$no_increment)=@_;
 	my $key = "$symb\0$uname\0$udom";
 	return $analyze_cache{$key} if (exists($analyze_cache{$key}));
 
@@ -290,15 +290,16 @@
 					    'grade_symb' => $symb,
 					    'grade_courseid' => 
 					    $env{'request.course.id'},
-					    'grade_username' => $uname));
+					    'grade_username' => $uname,
+                                            'grade_noincrement' => $no_increment));
 	(undef,$subresult)=split(/_HASH_REF__/,$subresult,2);
 	my %analyze=&Apache::lonnet::str2hash($subresult);
 	return $analyze_cache{$key} = \%analyze;
     }
 
     sub get_order {
-	my ($partid,$respid,$symb,$uname,$udom)=@_;
-	my $analyze = &get_analyze($symb,$uname,$udom);
+	my ($partid,$respid,$symb,$uname,$udom,$no_increment)=@_;
+	my $analyze = &get_analyze($symb,$uname,$udom,$no_increment);
 	return $analyze->{"$partid.$respid.shown"};
     }
 
@@ -4410,6 +4411,7 @@
     }
 
     my $interaction;
+    my $no_increment = 1;
     for ($version=1;$version<=$$record{'version'};$version++) {
 	my $timestamp = 
 	    &Apache::lonlocal::locallocaltime($$record{$version.':timestamp'});
@@ -4453,7 +4455,8 @@
 		    if (!exists($orders{$partid})) { $orders{$partid}={}; }
 		    if (!exists($orders{$partid}->{$responseId})) {
 			$orders{$partid}->{$responseId}=
-			    &get_order($partid,$responseId,$symb,$uname,$udom);
+			    &get_order($partid,$responseId,$symb,$uname,$udom,
+                                       $no_increment);
 		    }
 		    $displaySub[0].='</b>&nbsp; '.
 			&cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom).'<br />';
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.480 loncom/xml/lonxml.pm:1.481
--- loncom/xml/lonxml.pm:1.480	Tue Jun 10 12:20:39 2008
+++ loncom/xml/lonxml.pm	Wed Jun 25 08:00:37 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.480 2008/06/10 16:20:39 www Exp $
+# $Id: lonxml.pm,v 1.481 2008/06/25 12:00:37 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1084,7 +1084,7 @@
 
 sub increment_counter {
     my ($increment, $part_response) = @_;
-    if ($env{'form.grade_target'} eq 'analyze') { return; }
+    if ($env{'form.grade_noincrement'}) { return; }
     if (!defined($increment) || $increment le 0) {
 	$increment = 1;
     }