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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 18 Apr 2005 22:33:39 -0000


albertel		Mon Apr 18 18:33:39 2005 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  - style police
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.285 loncom/homework/structuretags.pm:1.286
--- loncom/homework/structuretags.pm:1.285	Mon Apr 18 17:10:41 2005
+++ loncom/homework/structuretags.pm	Mon Apr 18 18:33:38 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.285 2005/04/18 21:10:41 raeburn Exp $
+# $Id: structuretags.pm,v 1.286 2005/04/18 22:33:38 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -347,24 +347,28 @@
 # and corrects for each part for an instance of a problem, as appropriate.
 sub store_aggregates {
     my ($symb,$courseid) = @_;
-    my %aggregate = ();
-    my @parts = ();
-    my ($cdomain,$cname) = split/_/,$courseid;
-    foreach my $key (keys %Apache::lonhomework::results) {
+    my %aggregate;
+    my @parts;
+    my ($cdomain,$cname) = split(/_/,$courseid);
+    foreach my $key (keys(%Apache::lonhomework::results)) {
         if ($key =~ /resource\.(\d+)\.tries/) {
-            push @parts, $1;
+            push(@parts, $1);
         }
     }
-    foreach (@parts) {
-        if ($Apache::lonhomework::results{'resource.'.$_.'.award'} eq 'APPROX_ANS' || $Apache::lonhomework::results{'resource.'.$_.'.award'} eq 'EXACT_ANS') {
-            $aggregate{$symb.'_'.$_.'_correct'} = 1;
+    foreach my $part (@parts) {
+        if ($Apache::lonhomework::results{'resource.'.$part.'.award'}
+	    eq 'APPROX_ANS' ||
+	    $Apache::lonhomework::results{'resource.'.$part.'.award'}
+	    eq 'EXACT_ANS') {
+            $aggregate{$symb.'_'.$part.'_correct'} = 1;
         }
-        if ($Apache::lonhomework::results{'resource.'.$_.'.tries'} == 1) {
-            $aggregate{$symb.'_'.$_.'_users'} = 1;
+        if ($Apache::lonhomework::results{'resource.'.$part.'.tries'} == 1) {
+            $aggregate{$symb.'_'.$part.'_users'} = 1;
         }
-        $aggregate{$symb.'_'.$_.'_attempts'} = 1;
+        $aggregate{$symb.'_'.$part.'_attempts'} = 1;
     }
-    &Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,$cdomain,$cname); 
+    &Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
+			  $cdomain,$cname); 
 }
 
 sub checkout_msg {