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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 14 Oct 2002 20:33:57 -0000


albertel		Mon Oct 14 16:33:57 2002 EDT

  Modified files:              
    /loncom/homework	radiobuttonresponse.pm 
  Log:
  - should only create the table in exam mode
  - fixes problem with random numbers changing in grade target
  
  
Index: loncom/homework/radiobuttonresponse.pm
diff -u loncom/homework/radiobuttonresponse.pm:1.54 loncom/homework/radiobuttonresponse.pm:1.55
--- loncom/homework/radiobuttonresponse.pm:1.54	Wed Oct  2 14:12:51 2002
+++ loncom/homework/radiobuttonresponse.pm	Mon Oct 14 16:33:57 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # mutliple choice style responses
 #
-# $Id: radiobuttonresponse.pm,v 1.54 2002/10/02 18:12:51 sakharuk Exp $
+# $Id: radiobuttonresponse.pm,v 1.55 2002/10/14 20:33:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -102,12 +102,13 @@
 
 sub grade_response {
   my ($max,$randomize)=@_;
+  #keep the random numbers the same must always call this
+  my ($answer,@whichfoils)=&whichfoils($max,$randomize);
   if (!defined($ENV{'form.submitted'})) { return; }
   my $response = $ENV{'form.HWVAL'.$Apache::inputtags::response['-1']};
   if ( $response !~ /[0-9]+/) { return; }
   my $part=$Apache::inputtags::part;
   my $id = $Apache::inputtags::response['-1'];
-  my ($answer,@whichfoils)=&whichfoils($max,$randomize);
   my %responsehash;
   $responsehash{$whichfoils[$response]}=$response;
   my $responsestr=&Apache::lonnet::hash2str(%responsehash);
@@ -369,7 +370,9 @@
 	  $result.="<br /><input type=\"radio\" name=\"HWVAL$Apache::inputtags::response['-1']\" value=\"$temp\" ";
 	  if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }
 	  $result .= '>'.$Apache::response::foilgroup{$name.'.text'}."</input>\n";
-	  $result .= '<table border="1"><tr><td>A: &nbsp;&nbsp;Correct</td><td>B: &nbsp;&nbsp;Incorrect</td></tr></table>';
+	  if ($Apache::lonhomework::type eq 'exam') {
+	      $result .= '<table border="1"><tr><td>A: &nbsp;&nbsp;Correct</td><td>B: &nbsp;&nbsp;Incorrect</td></tr></table>';
+	  }
       } else {
 	  $result .= '\item '.$Apache::response::foilgroup{$name.'.text'};
 	  if ($Apache::lonhomework::type eq 'exam') {