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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 27 Nov 2002 16:50:09 -0000


albertel		Wed Nov 27 11:50:09 2002 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  - need to always check if default_homework is loaded.
  -fixes BUG#997
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.73 loncom/homework/caparesponse/caparesponse.pm:1.74
--- loncom/homework/caparesponse/caparesponse.pm:1.73	Mon Nov 25 16:36:42 2002
+++ loncom/homework/caparesponse/caparesponse.pm	Wed Nov 27 11:50:09 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.73 2002/11/25 21:36:42 albertel Exp $
+# $Id: caparesponse.pm,v 1.74 2002/11/27 16:50:09 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -122,6 +122,9 @@
 sub end_numericalresponse {
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
   my $result = '';
+  if (!$Apache::lonxml::default_homework_loaded) {
+      &Apache::lonxml::default_homework_load($safeeval);
+  }
   if ( $target eq 'grade' ) {
     if ( defined $ENV{'form.submitted'}) {
       &Apache::response::setup_params($$tagstack[-1]);
@@ -130,9 +133,6 @@
       my $id = $Apache::inputtags::response['-1'];
       my $response = $ENV{'form.HWVAL'.$id};
       if ( $response =~ /[^\s]/) {
-	if (!$Apache::lonxml::default_homework_loaded) {
-	    &Apache::lonxml::default_homework_load($safeeval);
-	}
 	my %previous = &Apache::response::check_for_previous($response,$partid,$id);
 	$Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response;
 	&Apache::lonxml::debug("submitted a $response<br>\n");