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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 08 May 2003 15:33:15 -0000


albertel		Thu May  8 11:33:15 2003 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm inputtags.pm 
  Log:
  - better solution to BUG1375/723 now after a part is correct it status is set to 'CANNOT_ANSWER'
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.120 loncom/homework/lonhomework.pm:1.121
--- loncom/homework/lonhomework.pm:1.120	Wed Apr 30 17:27:57 2003
+++ loncom/homework/lonhomework.pm	Thu May  8 11:33:15 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.120 2003/04/30 21:27:57 albertel Exp $
+# $Id: lonhomework.pm,v 1.121 2003/05/08 15:33:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -50,6 +50,7 @@
 use Apache::externalresponse();
 use Apache::rankresponse();
 use Apache::matchresponse();
+use Apache::chemresponse();
 use Apache::Constants qw(:common);
 use HTML::Entities();
 use Apache::loncommon();
@@ -207,12 +208,15 @@
     $datemsg = "was due on $lastdate, and answers will be available on $date";
   }
   if ($status eq 'CAN_ANSWER') {
-    #check #tries
+    #check #tries, and if correct.
     my $tries = $Apache::lonhomework::history{"resource.$id.tries"};
     my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries");
     if ( $tries eq '' ) { $tries = '0'; }
     if ( $maxtries eq '' ) { $maxtries = '2'; } 
     if ($tries >= $maxtries) { $status = 'CANNOT_ANSWER'; } 
+    if($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/) {
+	$status = 'CANNOT_ANSWER';
+    }
   }
 
   if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') &&
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.99 loncom/homework/inputtags.pm:1.100
--- loncom/homework/inputtags.pm:1.99	Thu May  8 11:22:03 2003
+++ loncom/homework/inputtags.pm	Thu May  8 11:33:15 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.99 2003/05/08 15:22:03 albertel Exp $
+# $Id: inputtags.pm,v 1.100 2003/05/08 15:33:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -82,9 +82,7 @@
   my $resid=$Apache::inputtags::response[-1];
   if ($target eq 'web') {
     $Apache::lonxml::evaluate--;
-    if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER'  &&
-        $Apache::lonhomework::history{"resource.$id.solved"} =~/^correct/
-	) {
+    if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
 	my $partid=$Apache::inputtags::part;
 	my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"});
 	my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval);
@@ -164,9 +162,7 @@
     $Apache::lonxml::evaluate--;
     my $partid=$Apache::inputtags::part;
     my $id=$Apache::inputtags::response[-1];
-    if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER' &&
-        $Apache::lonhomework::history{"resource.$id.solved"} =~/^correct/
-	) {
+    if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
       my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);
       my $maxlength;
       if ($size eq '') { $size=20; } else {