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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 31 Oct 2006 21:29:38 -0000


albertel		Tue Oct 31 16:29:38 2006 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - reverse order, first do all grading and commit it before removing from grading queue
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.187 loncom/homework/bridgetask.pm:1.188
--- loncom/homework/bridgetask.pm:1.187	Tue Oct 31 16:22:33 2006
+++ loncom/homework/bridgetask.pm	Tue Oct 31 16:29:38 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.187 2006/10/31 21:22:33 albertel Exp $
+# $Id: bridgetask.pm,v 1.188 2006/10/31 21:29:38 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1142,34 +1142,13 @@
 		$env{'user.name'}.':'.$env{'user.domain'};
 	    if ($review) {
 		$Apache::lonhomework::results{"resource.$version.0.status"}='review';
-		if ($env{'form.queue'} eq 'reviewqueue') {
-		    &check_queue_unlock($env{'form.queue'});
-		    &Apache::lonxml::debug(" still needs review not changing status.");
-		} else {
-		    if ($env{'form.queue'} ne 'none') {
-			&move_between_queues($env{'form.queue'},'reviewqueue');
-		    } else {
-			&add_to_queue('reviewqueue',\%queue_data);
-		    }
-		}
 	    } elsif ($ungraded) {
 		$Apache::lonhomework::results{"resource.$version.0.status"}='ungraded';
-		if ($env{'form.queue'} eq 'reviewqueue') {
-		    &Apache::lonxml::debug("moving back.");
-		    &move_between_queues($env{'form.queue'},
-					 'gradingqueue');
-		} elsif ($env{'form.queue'} eq 'none' ) {
-		    &add_to_queue('gradingqueue',\%queue_data);	
-		} else {
-		    &check_queue_unlock($env{'form.queue'});
-		}
 	    } elsif ($mandatory_failed) {
 		$Apache::lonhomework::results{"resource.$version.0.status"}='fail';
 		$Apache::lonhomework::results{"resource.$version.0.solved"}='incorrect_by_override';
 		$Apache::lonhomework::results{"resource.$version.0.award"}='INCORRECT';
 		$Apache::lonhomework::results{"resource.$version.0.awarded"}='0';
-		&remove_from_queue($env{'form.queue'}); 
-
 		my ($symb,$courseid,$udom,$uname)=&Apache::lonnet::whichuser();
 		
 		if ($env{'form.regrade'} ne 'yes') {
@@ -1186,8 +1165,6 @@
 		$Apache::lonhomework::results{"resource.$version.0.solved"}='correct_by_override';
 		$Apache::lonhomework::results{"resource.$version.0.award"}='EXACT_ANS';
 		$Apache::lonhomework::results{"resource.$version.0.awarded"}='1';
-		&remove_from_queue($env{'form.queue'});
-
 		my ($symb,$courseid,$udom,$uname)=&Apache::lonnet::whichuser();
 		if ($env{'form.regrade'} ne 'yes') {
 		    $Apache::lonhomework::results{"resource.$version.0.bridgetask.portfiles"}=
@@ -1211,6 +1188,34 @@
 	    }
 	    &minimize_storage();
 	    &Apache::structuretags::finalize_storage();
+	    
+	    # data stored, now handle queue
+	    if ($review) {
+		if ($env{'form.queue'} eq 'reviewqueue') {
+		    &check_queue_unlock($env{'form.queue'});
+		    &Apache::lonxml::debug(" still needs review not changing status.");
+		} else {
+		    if ($env{'form.queue'} ne 'none') {
+			&move_between_queues($env{'form.queue'},'reviewqueue');
+		    } else {
+			&add_to_queue('reviewqueue',\%queue_data);
+		    }
+		}
+	    } elsif ($ungraded) {
+		if ($env{'form.queue'} eq 'reviewqueue') {
+		    &Apache::lonxml::debug("moving back.");
+		    &move_between_queues($env{'form.queue'},
+					 'gradingqueue');
+		} elsif ($env{'form.queue'} eq 'none' ) {
+		    &add_to_queue('gradingqueue',\%queue_data);	
+		} else {
+		    &check_queue_unlock($env{'form.queue'});
+		}
+	    } elsif ($mandatory_failed) {
+		&remove_from_queue($env{'form.queue'}); 
+	    } else {
+		&remove_from_queue($env{'form.queue'});
+	    }
 	}
 	if (exists($Apache::lonhomework::results{'INTERNAL_store'})) {
 	    # instance generation occured and hasn't yet been stored
@@ -1563,7 +1568,6 @@
     foreach my $key (sort(keys(%queue))) {
 	my ($symb,$uname,$udom) = &decode_queue_key($key);
 	if (!defined($classlist->{$uname.':'.$udom})) { next; }
-
 	if ($key=~/locked$/) {
 	    $locks++;
 	} elsif ($key=~/timestamp$/) {