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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 03 Feb 2006 23:53:30 -0000


albertel		Fri Feb  3 18:53:30 2006 EDT

  Modified files:              
    /loncom/interface	slotrequest.pm 
  Log:
  - allowed_slot checks for uniqueperiod conflicts for conflicting slots that have started
  
  
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.43 loncom/interface/slotrequest.pm:1.44
--- loncom/interface/slotrequest.pm:1.43	Fri Feb  3 18:42:54 2006
+++ loncom/interface/slotrequest.pm	Fri Feb  3 18:53:30 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.43 2006/02/03 23:42:54 albertel Exp $
+# $Id: slotrequest.pm,v 1.44 2006/02/03 23:53:30 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -498,7 +498,7 @@
 }
 
 sub allowed_slot {
-    my ($slot_name,$slot,$symb)=@_;
+    my ($slot_name,$slot,$symb,$slots)=@_;
     #already started
     if ($slot->{'starttime'} < time) {
 	# all open slot to be schedulable
@@ -521,6 +521,12 @@
 	&& $slot->{'symb'} ne $symb) {
 	return 0;
     }
+    my $conflict = &check_for_conflict($symb,$slot_name,$slot,$slots);
+    if ($conflict) {
+	if ($slots->{$conflict}{'starttime'} < time) {
+	    return 0;
+	}
+    }
     &Apache::lonxml::debug("$slot_name symb good");
     return 1;
 }
@@ -550,7 +556,7 @@
 		      (keys(%slots)))  {
 
 	&Apache::lonxml::debug("Checking Slot $slot");
-	next if (!&allowed_slot($slot,$slots{$slot}));
+	next if (!&allowed_slot($slot,$slots{$slot},undef,\%slots));
 
 	$available++;