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

banghart lon-capa-cvs@mail.lon-capa.org
Tue, 28 Mar 2006 17:54:45 -0000


banghart		Tue Mar 28 12:54:45 2006 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  	version_portfiles now takes former arguments, and returns array
  	of keys changed.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.342 loncom/homework/grades.pm:1.343
--- loncom/homework/grades.pm:1.342	Mon Mar 27 19:46:20 2006
+++ loncom/homework/grades.pm	Tue Mar 28 12:54:44 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.342 2006/03/28 00:46:20 banghart Exp $
+# $Id: grades.pm,v 1.343 2006/03/28 17:54:44 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2364,7 +2364,10 @@
 
     if (scalar(keys(%newrecord)) > 0) {
         if (scalar(@version_parts)) {
-            &version_portfiles(\%record, \%newrecord, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname, \@version_parts);
+            my @changed_keys = &version_portfiles(\%record, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname, \@version_parts);
+            foreach my $key(@changed_keys) {
+                $newrecord{$key} = $record{$key};
+            }
         }
 	&Apache::lonnet::cstore(\%newrecord,$symb,
 				$env{'request.course.id'},$domain,$stuname);
@@ -2504,8 +2507,9 @@
 
 # ----------- Handles creating versions for portfolio files as answers
 sub version_portfiles {
-    my ($record, $newrecord, $parts_graded, $courseid, $symb, $domain, $stu_name, $v_flag) = @_;
+    my ($record, $parts_graded, $courseid, $symb, $domain, $stu_name, $v_flag) = @_;
     my $version_parts = join('|',@$v_flag);
+    my @returned_keys;
     my $parts = join('|', @$parts_graded);
     my $portfolio_root = &Apache::loncommon::propath($domain,
 						 $stu_name).
@@ -2530,10 +2534,11 @@
                         [$symb,$env{'request.course.id'},'graded']);
                 }
             }
-            $$newrecord{$key} = join(',',@versioned_portfiles);
+            $$record{$key} = join(',',@versioned_portfiles);
+            push(@returned_keys,$key);
         }
     } 
-    return 'ok';   
+    return (@returned_keys);   
 }
 
 sub get_next_version {