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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 15 Nov 2005 15:55:12 -0000


albertel		Tue Nov 15 10:55:12 2005 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - sort but name if it exists otherwise sort by username
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.293 loncom/homework/grades.pm:1.294
--- loncom/homework/grades.pm:1.293	Sat Oct 29 22:40:09 2005
+++ loncom/homework/grades.pm	Tue Nov 15 10:55:11 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.293 2005/10/30 02:40:09 www Exp $
+# $Id: grades.pm,v 1.294 2005/11/15 15:55:11 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -545,7 +545,13 @@
     if ($env{"course.$courseid.receiptalg"} eq 'receipt2') { $receiptparts=1; }
     my $parts=['0'];
     if ($receiptparts) { ($parts)=&response_type($url,$symb); }
-    foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
+    foreach (sort 
+	     {
+		 if (lc($$fullname{$a}) ne lc($$fullname{$b})) {
+		     return (lc($$fullname{$a}) cmp lc($$fullname{$b}));
+		 }
+		 return $a cmp $b;
+	     } (keys(%$fullname))) {
 	my ($uname,$udom)=split(/\:/);
 	foreach my $part (@$parts) {
 	    if ($receipt eq &Apache::lonnet::ireceipt($uname,$udom,$courseid,$symb,$part)) {
@@ -711,7 +717,14 @@
     $gradeTable.='</tr>'."\n";
 
     my $ctr = 0;
-    foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
+    foreach my $student (sort 
+			 {
+			     if (lc($$fullname{$a}) ne lc($$fullname{$b})) {
+				 return (lc($$fullname{$a}) cmp lc($$fullname{$b}));
+			     }
+			     return $a cmp $b;
+			 }
+			 (keys(%$fullname))) {
 	my ($uname,$udom) = split(/:/,$student);
 	my %status = ();
 	if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
@@ -2073,7 +2086,13 @@
 
     my (@parsedlist,@nextlist);
     my ($nextflg) = 0;
-    foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
+    foreach (sort 
+	     {
+		 if (lc($$fullname{$a}) ne lc($$fullname{$b})) {
+		     return (lc($$fullname{$a}) cmp lc($$fullname{$b}));
+		 }
+		 return $a cmp $b;
+	     } (keys(%$fullname))) {
 	if ($nextflg == 1 && $button =~ /Next$/) {
 	    push @parsedlist,$_;
 	}
@@ -2651,7 +2670,13 @@
     #list all the students - with points and grade status
     my (undef,undef,$fullname) = &getclasslist($env{'form.section'},'1');
     my $ctr = 0;
-    foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
+    foreach (sort 
+	     {
+		 if (lc($$fullname{$a}) ne lc($$fullname{$b})) {
+		     return (lc($$fullname{$a}) cmp lc($$fullname{$b}));
+		 }
+		 return $a cmp $b;
+	     } (keys(%$fullname))) {
 	$ctr++;
 	$result.=&viewstudentgrade($url,$symb,$env{'request.course.id'},
 				   $_,$$fullname{$_},\@parts,\%weight,$ctr,\%last_resets);
@@ -3409,7 +3434,13 @@
  
     my (undef,undef,$fullname) = &getclasslist($getsec,'1');
     my $ptr = 1;
-    foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
+    foreach my $student (sort 
+			 {
+			     if (lc($$fullname{$a}) ne lc($$fullname{$b})) {
+				 return (lc($$fullname{$a}) cmp lc($$fullname{$b}));
+			     }
+			     return $a cmp $b;
+			 } (keys(%$fullname))) {
 	my ($uname,$udom) = split(/:/,$student);
 	$studentTable.=($ptr%2 == 1 ? '<tr bgcolor="#ffffe6">' : '</td>');
 	$studentTable.='<td align="right">'.$ptr.'&nbsp;</td>';