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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 25 Mar 2004 16:55:16 -0000


albertel		Thu Mar 25 11:55:16 2004 EDT

  Modified files:              
    /loncom/homework	optionresponse.pm response.pm 
  Log:
  - Start on BUG#2730, annotate in the analyze data structure whether an answer is computed or not.
  
  
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.104 loncom/homework/optionresponse.pm:1.105
--- loncom/homework/optionresponse.pm:1.104	Mon Mar 15 17:09:52 2004
+++ loncom/homework/optionresponse.pm	Thu Mar 25 11:55:16 2004
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.104 2004/03/15 22:09:52 albertel Exp $
+# $Id: optionresponse.pm,v 1.105 2004/03/25 16:55:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -530,7 +530,10 @@
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
   my $result='';
   if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze' ) {
-    &Apache::lonxml::startredirection;
+      &Apache::lonxml::startredirection;
+      if ($target eq 'analyze') {
+	  &Apache::response::check_if_computed($token,$parstack,$safeeval,'value');
+      }
   } elsif ($target eq 'edit') {
     $result=&Apache::edit::tag_start($target,$token,"Foil");
     my $level='-2';
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.95 loncom/homework/response.pm:1.96
--- loncom/homework/response.pm:1.95	Tue Mar 16 17:00:51 2004
+++ loncom/homework/response.pm	Thu Mar 25 11:55:16 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.95 2004/03/16 22:00:51 albertel Exp $
+# $Id: response.pm,v 1.96 2004/03/25 16:55:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -595,6 +595,15 @@
 	}
     }
     push (@{ $Apache::lonhomework::analyze{"$part_id.shown"} }, @{ $shown });
+}
+
+sub check_if_computed {
+    my ($token,$parstack,$safeeval,$name)=@_;
+    my $value = &Apache::lonxml::get_param($name,$parstack,$safeeval);
+    if ($value ne $token->[2]{$name}) {
+	my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]";
+	$Apache::lonhomework::analyze{"$part_id.answercomputed"} = 1;
+    }
 }
 
 sub pick_foil_for_concept {