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

banghart lon-capa-cvs@mail.lon-capa.org
Fri, 08 Apr 2005 20:12:58 -0000


banghart		Fri Apr  8 16:12:58 2005 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  	Save work in progress, preparing to deal with multiple parts
  	in versioning portfiles.
  
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.261 loncom/homework/grades.pm:1.262
--- loncom/homework/grades.pm:1.261	Fri Apr  8 15:26:58 2005
+++ loncom/homework/grades.pm	Fri Apr  8 16:12:58 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.261 2005/04/08 19:26:58 albertel Exp $
+# $Id: grades.pm,v 1.262 2005/04/08 20:12:58 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2109,7 +2109,7 @@
 #---- Save the score and award for each student, if changed
 sub saveHandGrade {
     my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter,$part) = @_;
-    my $v_flag=0;
+    my @v_flag;
     my $usec = &Apache::lonnet::getsection($domain,$stuname,
 					   $env{'request.course.id'});
     if (!&canmodify($usec)) { return('not_allowed'); }
@@ -2174,13 +2174,15 @@
 	}
 	# unless problem has been graded, set flag to version the submitted files
 	unless ($record{'resource.'.$new_part.'.solved'} =~ /^correct_/  || $record{'resource.'.$new_part.'.solved'} eq 'incorrect_by_override') {
-	    $v_flag = 1;
+	    push (@v_flag,$new_part);
 	}
     }
     if (scalar(keys(%newrecord)) > 0) {
-        if ($v_flag) {
-            &Apache::lonnet::unmark_as_readonly($domain,$stuname,$symb.$env{'request.course.id'});
-            &version_portfiles(\%record, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname);
+        if (scalar @v_flag) {
+            foreach my $part_flagged (@v_flag) {
+                &Apache::lonnet::unmark_as_readonly($domain,$stuname,$symb.$env{'request.course.id'});
+                &version_portfiles(\%record, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname);
+            }
         }
 	&Apache::lonnet::cstore(\%newrecord,$symb,
 				$env{'request.course.id'},$domain,$stuname);