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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 28 Mar 2006 18:07:24 -0000


albertel		Tue Mar 28 13:07:24 2006 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - using a hash slice is neat
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.343 loncom/homework/grades.pm:1.344
--- loncom/homework/grades.pm:1.343	Tue Mar 28 12:54:44 2006
+++ loncom/homework/grades.pm	Tue Mar 28 13:07:24 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.343 2006/03/28 17:54:44 banghart Exp $
+# $Id: grades.pm,v 1.344 2006/03/28 18:07:24 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2362,12 +2362,10 @@
     my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
 
-    if (scalar(keys(%newrecord)) > 0) {
-        if (scalar(@version_parts)) {
+    if (%newrecord) {
+        if (@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};
-            }
+	    @newrecord{@changed_keys} = @record{@changed_keys};
         }
 	&Apache::lonnet::cstore(\%newrecord,$symb,
 				$env{'request.course.id'},$domain,$stuname);