[LON-CAPA-cvs] cvs: loncom /enrollment Autoenroll.pl

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 05 Dec 2007 02:04:02 -0000


raeburn		Tue Dec  4 21:04:02 2007 EDT

  Modified files:              
    /loncom/enrollment	Autoenroll.pl 
  Log:
  - Use lonnet::coursedescription() to extract cnum from cid instead of using custom regexp.
  
  
Index: loncom/enrollment/Autoenroll.pl
diff -u loncom/enrollment/Autoenroll.pl:1.27 loncom/enrollment/Autoenroll.pl:1.28
--- loncom/enrollment/Autoenroll.pl:1.27	Tue May 15 02:19:53 2007
+++ loncom/enrollment/Autoenroll.pl	Tue Dec  4 21:04:02 2007
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 #
 #Automated Enrollment script
-# $Id: Autoenroll.pl,v 1.27 2007/05/15 06:19:53 raeburn Exp $
+# $Id: Autoenroll.pl,v 1.28 2007/12/05 02:04:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -75,11 +75,12 @@
         my %reply = ();
         my %LC_code = ();
         foreach my $key (sort keys %courses) {
-            my $crs;
-            if ($key =~ m/^($dom)_(\w+)$/) {
-                $crs = $2;
-            }
-
+            my %args = (
+                         one_time => 1,
+                       );
+            my %coursehash = &Apache::lonnet::coursedescription($key,\%args);
+            my $crs = $coursehash{'num'};
+            next if ($coursehash{'domain'} ne $dom);
 # Get course settings
             my %settings = &Apache::lonnet::dump('environment',$dom,$crs);
             %{$enrollvar{$crs}} = ();