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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 05 Apr 2005 15:39:41 -0000


albertel		Tue Apr  5 11:39:41 2005 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm inputtags.pm 
  Log:
  - bridgetask responses are remebered
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.9 loncom/homework/bridgetask.pm:1.10
--- loncom/homework/bridgetask.pm:1.9	Mon Apr  4 14:14:58 2005
+++ loncom/homework/bridgetask.pm	Tue Apr  5 11:39:41 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.9 2005/04/04 18:14:58 albertel Exp $
+# $Id: bridgetask.pm,v 1.10 2005/04/05 15:39:41 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -188,6 +188,11 @@
 	    }
 	}
 	if ($target eq 'grade') {
+	    &Apache::essayresponse::file_submission('0','bridgetask','portfiles','SUBMITTED');
+	    if ($Apache::lonhomework::results{"resource.0.bridgetask.portfiles"}) {
+		$Apache::lonhomework::results{"resource.0.tries"}=
+		    1+$Apache::lonhomework::history{"resource.0.tries"};
+	    }
 	    &Apache::lonhomework::showhash(%Apache::lonhomework::results);
 	    &Apache::structuretags::finalize_storage();
 	}
@@ -235,9 +240,8 @@
 	#to randomly pick one until all have been seen
 	#then start repicking
 	&Apache::response::pushrandomnumber();
-	my $num_instances=scalar(@{$dimension{'instances'}});
-	my $which=&Math::Random::random_uniform_integer(1,0,$num_instances-1);
-	my $instance=$dimension{'instances'}->[$which];
+	my @order=&Math::Random::random_permutation(@{$dimension{'instances'}});
+	my $instance=$order[0];
 	$result=$dimension{'intro'}.$dimension{$instance.'.text'};
 	#FIXME: don't show the criteria yet
 	#foreach my $id (@{$dimension{$instance.'.criterias'}}) {
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.163 loncom/homework/inputtags.pm:1.164
--- loncom/homework/inputtags.pm:1.163	Thu Mar 31 16:34:34 2005
+++ loncom/homework/inputtags.pm	Tue Apr  5 11:39:41 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.163 2005/03/31 21:34:34 albertel Exp $
+# $Id: inputtags.pm,v 1.164 2005/04/05 15:39:41 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -808,7 +808,10 @@
 	if ( $maxtries eq '' ) { $maxtries = '2'; } 
 	if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } 
 	my $tries_text=&mt('Tries');
-	if ( $Apache::lonhomework::type eq 'survey') { $tries_text=&mt('Submissions'); }
+	if ( $Apache::lonhomework::type eq 'survey' ||
+	     $Apache::lonhomework::parsing_a_task) {
+	    $tries_text=&mt('Submissions');
+	}
 	if ( $showbutton ) {
 	    if ($target eq 'tex') {
 		if ($ENV{'request.state'} ne "construct" && $Apache::lonhomework::type ne 'exam' && $ENV{'form.suppress_tries'} ne 'yes') {
@@ -818,7 +821,8 @@
 		}
 	    } else {
 		$trystr = "<td><nobr>".$tries_text." $tries";
-		if($ENV{'request.state'} ne 'construct') {
+		if ($Apache::lonhomework::parsing_a_task) {
+		} elsif($ENV{'request.state'} ne 'construct') {
 		    $trystr.="/$maxtries";
 		} else {
 		    if (defined($Apache::inputtags::params{'maxtries'})) {