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

foxr foxr at source.lon-capa.org
Thu Jun 7 06:27:26 EDT 2012


foxr		Thu Jun  7 10:27:26 2012 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  BZ6202 - Sorted without an assumption about how the students are orderd when
  gotten from the course (there was an implicit assumption of section/stud
  sorting).
  
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.617 loncom/interface/lonprintout.pm:1.618
--- loncom/interface/lonprintout.pm:1.617	Mon May 28 10:44:42 2012
+++ loncom/interface/lonprintout.pm	Thu Jun  7 10:27:26 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.617 2012/05/28 10:44:42 foxr Exp $
+# $Id: lonprintout.pm,v 1.618 2012/06/07 10:27:26 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1233,6 +1233,22 @@
     }
 
 }
+#
+# Compare two students by section (Used to sort by section).
+#
+#  Implicit inputs, 
+#    $a - The first one
+#    $b - The second one.
+#
+#  Returns:
+#     a-section cmp b-section
+#
+sub compare_sections {
+    my ($u1, $d1, $s1, $n1, $stat1) = split(/:/, $a);
+    my ($u2, $d2, $s2, $n2, $stat2) = split(/:/, $b);
+
+    return $s1 cmp $s2;
+}
 
 #   Compare two students by name.  The students are in the form
 #   returned by the helper:
@@ -3103,6 +3119,8 @@
 	 if (($helper->{'VARS'}->{'student_sort'}    eq 1)  && 
 	     ($helper->{'VARS'}->{'SPLIT_PDFS'} ne "sections")) {
 	     @students = sort compare_names  @students;
+	 } else {
+	     @students = sort compare_sections @students; 
 	 }
 	 &adjust_number_to_print($helper);
 




More information about the LON-CAPA-cvs mailing list