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

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 01 Oct 2005 02:06:11 -0000


albertel		Fri Sep 30 22:06:11 2005 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - not allowed to do a regrade on a record in a slot still open
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.57 loncom/homework/bridgetask.pm:1.58
--- loncom/homework/bridgetask.pm:1.57	Fri Sep 30 16:34:53 2005
+++ loncom/homework/bridgetask.pm	Fri Sep 30 22:06:06 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.57 2005/09/30 20:34:53 albertel Exp $
+# $Id: bridgetask.pm,v 1.58 2005/10/01 02:06:06 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -835,6 +835,11 @@
 	if (defined($results{"$todo\0locked"})) {
 	    return 'locked';
 	}
+	my $slot=$results{$todo}->[0];
+	my %slot_data=&Apache::lonnet::get_slot($slot);
+	if ($slot_data{'endtime'} > time) { 
+	    return 'in_progress';
+	}
 	return 'enqueued';
     }
     return undef;
@@ -1119,14 +1124,25 @@
 	my ($uname,$udom) = split(/:/,$student);
 	my %status = &get_student_status($symb,$cid,$udom,$uname);
 	my $queue = 'none';
-	if ($status{'reviewqueue'} eq 'enqueued') {
+	my $cannot_grade;
+	if ($status{'reviewqueue'} =~ /^(in_progress|enqueue)$/) {
 	    $queue = 'reviewqueue';
-	} elsif ($status{'gradingqueue'} eq 'enqueued') {
+	    if ($status{'reviewqueue'} eq 'in_progress') {
+		$cannot_grade=1;
+	    }
+	} elsif ($status{'gradingqueue'} =~ /^(in_progress|enqueue)$/) {
 	    $queue = 'gradingqueue';
+	    if ($status{'gradingqueue'} eq 'in_progress') {
+		$cannot_grade=1;
+	    }
 	}
 	my $todo = 
 	    &Apache::lonnet::escape(&encode_queue_key($symb,$udom,$uname));
-	$result.=<<RESULT;
+	if ($cannot_grade) {
+	    $result.='<tr><td>&nbsp;</td><td>'.$fullname->{$student}.
+		'</td><td>';
+	} else {
+	    $result.=<<RESULT;
 <tr>
   <td>
     <form method="POST">
@@ -1139,7 +1155,7 @@
   <td>$fullname->{$student}</td>
   <td>
 RESULT
-
+        }
         if ($status{'status'} eq 'pass') {
 	    $result .= '<font color="green">'.&mt('Passed').'</font>';
 	} elsif ($status{'status'} eq 'fail') {
@@ -1161,10 +1177,14 @@
 	    $result .= &mt('Awaiting Review');
 	} elsif ($status{'reviewqueue'} eq 'locked') {
 	    $result .= &mt('Under Review');
+	} elsif ($status{'reviewqueue'} eq 'in_progress') {
+	    $result .= &mt('Still being worked on.');
 	} elsif ($status{'gradingqueue'} eq 'enqueued') {
 	    $result .= &mt('Awaiting Grading');
 	} elsif ($status{'gradingqueue'} eq 'locked') {
 	    $result .= &mt('Being Graded');
+	} elsif ($status{'gradingqueue'} eq 'in_progress') {
+	    $result .= &mt('Still being worked on.');
 	} else {
 	    $result.="&nbsp;";
 	}