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

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


albertel		Mon Apr 18 18:35:53 2005 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  - parts can have most any character in them not just \d
  - \0 is guarenteed to not be in a symb or part and thus more safer at separtion field like things
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.286 loncom/homework/structuretags.pm:1.287
--- loncom/homework/structuretags.pm:1.286	Mon Apr 18 18:33:38 2005
+++ loncom/homework/structuretags.pm	Mon Apr 18 18:35:52 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.286 2005/04/18 22:33:38 albertel Exp $
+# $Id: structuretags.pm,v 1.287 2005/04/18 22:35:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -351,7 +351,7 @@
     my @parts;
     my ($cdomain,$cname) = split(/_/,$courseid);
     foreach my $key (keys(%Apache::lonhomework::results)) {
-        if ($key =~ /resource\.(\d+)\.tries/) {
+        if ($key =~ /resource\.([^\.]+)\.tries/) {
             push(@parts, $1);
         }
     }
@@ -360,12 +360,12 @@
 	    eq 'APPROX_ANS' ||
 	    $Apache::lonhomework::results{'resource.'.$part.'.award'}
 	    eq 'EXACT_ANS') {
-            $aggregate{$symb.'_'.$part.'_correct'} = 1;
+            $aggregate{$symb."\0".$part."\0correct"} = 1;
         }
         if ($Apache::lonhomework::results{'resource.'.$part.'.tries'} == 1) {
-            $aggregate{$symb.'_'.$part.'_users'} = 1;
+            $aggregate{$symb."\0".$part."\0users"} = 1;
         }
-        $aggregate{$symb.'_'.$part.'_attempts'} = 1;
+        $aggregate{$symb."\0".$part."\0attempts"} = 1;
     }
     &Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
 			  $cdomain,$cname);