[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 15 Dec 2005 18:33:37 -0000


albertel		Thu Dec 15 13:33:37 2005 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  - show each CODE only once
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.404 loncom/interface/lonprintout.pm:1.405
--- loncom/interface/lonprintout.pm:1.404	Tue Dec 13 14:13:51 2005
+++ loncom/interface/lonprintout.pm	Thu Dec 15 13:33:37 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.404 2005/12/13 19:13:51 albertel Exp $
+# $Id: lonprintout.pm,v 1.405 2005/12/15 18:33:37 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2172,16 +2172,16 @@
         my %all_codes = &Apache::lonnet::get('CODEs',
 					     \@names, $cdom,$cnum);
 	my %code_values;
-	my @all_code_array;
-	foreach my $key (keys %all_codes) {
+	my %codes_to_print;
+	foreach my $key (keys(%all_codes)) {
 	    %code_values = &Apache::grades::get_codes($key, $cdom, $cnum);
-	    foreach my $key (keys %code_values) {
-		push (@all_code_array, "$key");
+	    foreach my $key (keys(%code_values)) {
+		$codes_to_print{$key} = 1;
 	    }
 	}
 
 	my $code_selection = "<choice></choice>\n";
-	foreach my $code (sort {uc($a) cmp uc($b)} @all_code_array) {
+	foreach my $code (sort {uc($a) cmp uc($b)} (keys(%codes_to_print))) {
 	    my $choice  = $code;
 	    if ($code =~ /^[A-Z]+$/) { # Alpha code
 		$choice = &letters_to_num($code);