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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 24 Jan 2006 06:41:19 -0000


albertel		Tue Jan 24 01:41:19 2006 EDT

  Modified files:              
    /loncom/interface	slotrequest.pm 
  Log:
  - unable to delete slots if the slot_reservations.db didn't exist
  
  
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.37 loncom/interface/slotrequest.pm:1.38
--- loncom/interface/slotrequest.pm:1.37	Wed Dec 14 17:26:10 2005
+++ loncom/interface/slotrequest.pm	Tue Jan 24 01:41:16 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for requesting to have slots added to a students record
 #
-# $Id: slotrequest.pm,v 1.37 2005/12/14 22:26:10 raeburn Exp $
+# $Id: slotrequest.pm,v 1.38 2006/01/24 06:41:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -325,6 +325,8 @@
     my ($cnum,$cdom)=&get_course();
     my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum,
 				       "^$slot_name\0");
+    my ($tmp) = %consumed;
+    if ($tmp =~ /error: 2/) { undef(%consumed); }
 
     if (%slot && !%consumed) {
 	$slot{'type'} = 'deleted';
@@ -732,13 +734,17 @@
 	my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum,
 					   "^$slot\0");
 	my $ids;
-	foreach my $entry (sort(keys(%consumed))) {
-	    my (undef,$id)=split("\0",$entry);
-	    my ($uname,$udom) = split('@',$consumed{$entry}{'name'});
-	    my $name = &Apache::loncommon::plainname($uname,$udom);
-	    $ids.= '<nobr>'.$name.&remove_link($slot,$entry,$uname,$udom,
-					       $consumed{$entry}{'symb'})
-		.'</nobr><br />';
+
+	my ($tmp)=%consumed;
+	if ($tmp !~ /^error: /) {
+	    foreach my $entry (sort(keys(%consumed))) {
+		my (undef,$id)=split("\0",$entry);
+		my ($uname,$udom) = split('@',$consumed{$entry}{'name'});
+		my $name = &Apache::loncommon::plainname($uname,$udom);
+		$ids.= '<nobr>'.$name.&remove_link($slot,$entry,$uname,$udom,
+						   $consumed{$entry}{'symb'})
+		    .'</nobr><br />';
+	    }
 	}
 
 	my $start=($slots{$slot}->{'starttime'}?