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

raeburn raeburn@source.lon-capa.org
Fri, 27 Mar 2009 00:20:39 -0000


raeburn		Fri Mar 27 00:20:39 2009 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - Error condition if navmap object unavailable.
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.245 loncom/homework/bridgetask.pm:1.246
--- loncom/homework/bridgetask.pm:1.245	Fri Mar 20 10:05:00 2009
+++ loncom/homework/bridgetask.pm	Fri Mar 27 00:20:39 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.245 2009/03/20 10:05:00 bisitz Exp $
+# $Id: bridgetask.pm,v 1.246 2009/03/27 00:20:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -82,7 +82,10 @@
 		}
 	    }
 	    if ($authenticated) {
-		&check_in($type,$user,$domain,$slot_name);
+		my $check = &check_in($type,$user,$domain,$slot_name);
+                if ($check =~ /^error:/) {
+                    return 0;
+                }
 		return 1;
 	    }
 	}
@@ -94,7 +97,10 @@
     my ($type,$user,$domain,$slot_name) = @_;
     my $useslots = &Apache::lonnet::EXT("resource.0.useslots");
     if ( $useslots eq 'map_map') {
-	&check_in_sequence($user,$domain,$slot_name);
+	my $result = &check_in_sequence($user,$domain,$slot_name);
+        if ($result =~ /^error: /) {
+            return $result;
+        }
     } else {
 	&create_new_version($type,$user,$domain,$slot_name);
 	&Apache::structuretags::finalize_storage();
@@ -105,6 +111,9 @@
 sub check_in_sequence {
     my ($user,$domain,$slot_name) = @_;
     my $navmap = Apache::lonnavmaps::navmap->new();
+    if (!defined($navmap)) {
+        return 'error: ';
+    }
     my ($symb) = &Apache::lonnet::whichuser();
     my ($map)  = &Apache::lonnet::decode_symb($symb);
     my @resources = 
@@ -655,7 +664,11 @@
 	if ($status eq 'CAN_ANSWER' && $version eq '') {
 	    # CAN_ANSWER mode, and no current version, unproctored access
 	    # thus self-checkedin
-	    &check_in('Task',undef,undef,$slot_name);
+	    my $check = &check_in('Task',undef,undef,$slot_name);
+            if ($check =~ /^error: /) {
+                my $symb=&Apache::lonnet::symbread();
+                &Apache::lonnet::logthis("Error during self-checkin of version $version of Task (symb: $symb) using slot: $slot_name");   
+            }
 	    &add_to_queue('gradingqueue',{'type' => 'Task',
 					  'time' => time,
 					  'slot' => $slot_name});