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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 22 Apr 2005 17:15:34 -0000


albertel		Fri Apr 22 13:15:34 2005 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  - don't cinc if %aggregate is empty
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.288 loncom/homework/structuretags.pm:1.289
--- loncom/homework/structuretags.pm:1.288	Mon Apr 18 18:39:35 2005
+++ loncom/homework/structuretags.pm	Fri Apr 22 13:15:33 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.288 2005/04/18 22:39:35 albertel Exp $
+# $Id: structuretags.pm,v 1.289 2005/04/22 17:15:33 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -321,8 +321,7 @@
 # if running user has student role.  
 sub finalize_storage {
     my $result;
-    my ($temp) = keys %Apache::lonhomework::results;
-    if ( $temp ne '' ) {
+    if (%Apache::lonhomework::results) {
 	my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
 	if ($env{'request.state'} eq 'construct' || $symb eq '') {
 	    $Apache::lonhomework::results{'rndseed'}=$env{'form.rndseed'};
@@ -340,6 +339,7 @@
     }
     return $result;
 }
+use Data::Dumper;
 
 # -------------------------------------------------------------store_aggregates
 # Sends hash of values to be incremented in nohist_resourcetracker.db
@@ -368,8 +368,11 @@
         }
         $aggregate{$symb."\0".$part."\0attempts"} = 1;
     }
-    &Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
-			  $cdomain,$cname); 
+    if (%aggregate) {
+	&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
+			      $cdomain,$cname); 
+
+    }
 }
 
 sub checkout_msg {