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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 18 Nov 2005 20:29:14 -0000


albertel		Fri Nov 18 15:29:14 2005 EDT

  Modified files:              
    /loncom/homework	structuretags.pm bridgetask.pm 
  Log:
  - new bridgetask randomization mode has been tested and works
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.322 loncom/homework/structuretags.pm:1.323
--- loncom/homework/structuretags.pm:1.322	Wed Nov 16 15:37:37 2005
+++ loncom/homework/structuretags.pm	Fri Nov 18 15:29:13 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.322 2005/11/16 20:37:37 albertel Exp $
+# $Id: structuretags.pm,v 1.323 2005/11/18 20:29:13 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -346,6 +346,8 @@
 sub finalize_storage {
     my $result;
     if (%Apache::lonhomework::results) {
+	my @remove = grep(/^INTERNAL_/,keys(%Apache::lonhomework::results));
+	delete(@Apache::lonhomework::results{@remove});
 	my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
 	if ($env{'request.state'} eq 'construct' || $symb eq '') {
 	    $Apache::lonhomework::results{'rndseed'}=$env{'form.rndseed'};
@@ -360,6 +362,8 @@
                 &store_aggregates($symb,$courseid);
             }
 	}
+    } else {
+	&Apache::lonxml::debug('Nothing to store');
     }
     return $result;
 }
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.78 loncom/homework/bridgetask.pm:1.79
--- loncom/homework/bridgetask.pm:1.78	Tue Nov 15 16:41:10 2005
+++ loncom/homework/bridgetask.pm	Fri Nov 18 15:29:13 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.78 2005/11/15 21:41:10 albertel Exp $
+# $Id: bridgetask.pm,v 1.79 2005/11/18 20:29:13 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -671,7 +671,6 @@
     }
     return (undef,undef)
 }
-
 sub end_Task {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my $result='';
@@ -779,6 +778,8 @@
 	    if ($award eq 'SUBMITTED') {
 		&add_to_queue('gradingqueue',$Apache::inputtags::slot_name);
 	    }
+	} elsif ($Apache::lonhomework::results{'INTERNAL_store'}) {
+	    &Apache::structuretags::finalize_storage();
 	}
 	if ($target eq 'grade' && $env{'form.webgrade'} eq 'yes') {
 	    my $optional_required=
@@ -1466,6 +1467,7 @@
 	$instance  = $instances[($version-1)%scalar(@instances)];
 	$Apache::lonhomework::results{"resource.$version.0.$dim.instance"} = 
 	    $instance;
+	$Apache::lonhomework::results{'INTERNAL_store'} = 1; 
 	&Apache::response::poprandomnumber();
 	return $instance;
     }