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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 31 Mar 2005 15:56:13 -0000


albertel		Thu Mar 31 10:56:13 2005 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
  Log:
  - proctor checkin works correctlyish
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.201 loncom/homework/lonhomework.pm:1.202
--- loncom/homework/lonhomework.pm:1.201	Mon Mar 21 13:53:51 2005
+++ loncom/homework/lonhomework.pm	Thu Mar 31 10:56:13 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.201 2005/03/21 18:53:51 albertel Exp $
+# $Id: lonhomework.pm,v 1.202 2005/03/31 15:56:13 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -163,6 +163,13 @@
 }
 
 sub proctor_checked_in {
+    my ($slot)=@_;
+    my @allowed=split(",",$slot->{'proctor'});
+    foreach my $possible (@allowed) { 
+	if ($Apache::lonhomework::history{'resource.checkedin'} eq $possible) {
+	    return 1;
+	}
+    }
     return 0;
 }
 
@@ -231,6 +238,7 @@
 #	return ($status,$datemsg);
 #    }
     my $slotstatus='NOT_IN_A_SLOT';
+    my $returned_slot;
     foreach my $slot (@slots) {
 	&Apache::lonxml::debug("getting $slot");
 	my %slot=&Apache::lonnet::get_slot($slot);
@@ -238,15 +246,18 @@
 	if ($slot{'starttime'} < time &&
 	    $slot{'endtime'} > time &&
 	    &check_ip_acc($slot{'ip'})) {
-	    $slotstatus='IN_A_SLOT';
+	    &Apache::lonxml::debug("$slot is good");
+	    $slotstatus='NEEDS_CHECKIN';
+	    $returned_slot=\%slot;
 	    last;
 	}
     }
-    if ($slotstatus eq 'IN_A_SLOT' &&
-	&proctor_checked_in()) {
+    if ($slotstatus eq 'NEEDS_CHECKIN' &&
+	&proctor_checked_in($returned_slot)) {
+	&Apache::lonxml::debug("protoctor checked in");
 	$slotstatus='CAN_ANSWER';
     }
-    return ($slotstatus,$datemsg);
+    return ($slotstatus,$datemsg,$returned_slot);
 }
 
 # JB, 9/24/2002: Any changes in this function may require a change