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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 07 Sep 2007 00:07:31 -0000


albertel		Thu Sep  6 20:07:31 2007 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - convert to using navmaps for part information
  - correct support of parts with _ in them (form improt prefixing) in the grade all students screens
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.438 loncom/homework/grades.pm:1.439
--- loncom/homework/grades.pm:1.438	Sat Sep  1 22:10:31 2007
+++ loncom/homework/grades.pm	Thu Sep  6 20:07:30 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.438 2007/09/02 02:10:31 www Exp $
+# $Id: grades.pm,v 1.439 2007/09/07 00:07:30 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -56,28 +56,15 @@
 # --- Retrieve the parts from the metadata file.---
 sub getpartlist {
     my ($symb) = @_;
-    my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb);
-    my $partorder = &Apache::lonnet::metadata($url, 'partorder');
-    my @parts;
-    if ($partorder) {
-	for my $part (split (/,/,$partorder)) {
-	    if (!&Apache::loncommon::check_if_partid_hidden($part,$symb)) {
-		push(@parts, $part);
-	    }
-	}	    
-    } else {
-	my $metadata = &Apache::lonnet::metadata($url, 'packages');
-	foreach (split(/\,/,$metadata)) {
-	    if ($_ =~ /^part_(.*)$/) {
-		if (!&Apache::loncommon::check_if_partid_hidden($1,$symb)) {
-		    push(@parts, $1);
-		}
-	    }
-	}
-    }
+
+    my $navmap   = Apache::lonnavmaps::navmap->new();
+    my $res      = $navmap->getBySymb($symb);
+    my $partlist = $res->parts();
+    my $url      = $res->src();
+    my @metakeys = split(/,/,&Apache::lonnet::metadata($url,'keys'));
+
     my @stores;
-    foreach my $part (@parts) {
-	my (@metakeys) = split(/,/,&Apache::lonnet::metadata($url,'keys'));
+    foreach my $part (@{ $partlist }) {
 	foreach my $key (@metakeys) {
 	    if ($key =~ m/^stores_\Q$part\E_/) { push(@stores,$key); }
 	}
@@ -3413,7 +3400,7 @@
     my ($partstr) = @_;
     my ($temp,@allparts)=split(/_/,$partstr);
     my $type=pop(@allparts);
-    my $part=join('.',@allparts);
+    my $part=join('_',@allparts);
     return ($part,$type);
 }