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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 09 Feb 2004 19:38:01 -0000


albertel		Mon Feb  9 14:38:01 2004 EDT

  Modified files:              
    /loncom/homework	response.pm matchresponse.pm rankresponse.pm 
  Log:
  - fixes <matchresponse> when used in scantorn exam
  - <rankresponse> should be better behaved too. but I need to do some testing still
  
  
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.89 loncom/homework/response.pm:1.90
--- loncom/homework/response.pm:1.89	Fri Nov 21 14:54:42 2003
+++ loncom/homework/response.pm	Mon Feb  9 14:38:00 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.89 2003/11/21 19:54:42 albertel Exp $
+# $Id: response.pm,v 1.90 2004/02/09 19:38:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -456,7 +456,7 @@
 }
 
 sub getresponse {
-    my ($temp)=@_;
+    my ($temp,$resulttype)=@_;
     my $formparm='form.HWVAL_'.$Apache::inputtags::response['-1'];
     my $response;
     if (!defined($temp)) {
@@ -476,7 +476,9 @@
 	# save bubbled letter for later
 	$Apache::lonhomework::results{"resource.$part.$id.scantron"}.=
 	    $response;
-	$response = $let_to_num{$response};
+	if ($resulttype ne 'letter') {
+	    $response = $let_to_num{$response};
+	}
     } else {
 	$response = $ENV{$formparm};
     }
Index: loncom/homework/matchresponse.pm
diff -u loncom/homework/matchresponse.pm:1.32 loncom/homework/matchresponse.pm:1.33
--- loncom/homework/matchresponse.pm:1.32	Tue Jan  6 15:16:17 2004
+++ loncom/homework/matchresponse.pm	Mon Feb  9 14:38:00 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Full matching style response
 #
-# $Id: matchresponse.pm,v 1.32 2004/01/06 20:16:17 sakharuk Exp $
+# $Id: matchresponse.pm,v 1.33 2004/02/09 19:38:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -306,7 +306,7 @@
     if (!defined($ENV{'form.submitted'})) { return; }
     my %responsehash;
     my %grade;
-    my ($temp,$right,$wrong,$ignored)=(0,0,0,0);
+    my ($temp,$right,$wrong,$ignored)=(1,0,0,0);
     my %letter_name_map;
     if (defined(%{ $Apache::response::itemgroup{'letter_name_map'} })) {
 	%letter_name_map=
@@ -320,7 +320,7 @@
 	my $value=$Apache::response::foilgroup{$name.'.value'};
 	if ( $response =~ /[^\s]/) {
 	    $responsehash{$name}=$responsename;
-	    &Apache::lonxml::debug("submitted a $response for $value<br />\n");
+	    &Apache::lonxml::debug("submitted a $response($responsename) for $value<br />\n");
 	    if ($value eq $responsename) {
 		$grade{$name}='1'; $right++;
 	    } else {
Index: loncom/homework/rankresponse.pm
diff -u loncom/homework/rankresponse.pm:1.27 loncom/homework/rankresponse.pm:1.28
--- loncom/homework/rankresponse.pm:1.27	Sat Nov 15 01:28:02 2003
+++ loncom/homework/rankresponse.pm	Mon Feb  9 14:38:00 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # rank style response
 #
-# $Id: rankresponse.pm,v 1.27 2003/11/15 06:28:02 albertel Exp $
+# $Id: rankresponse.pm,v 1.28 2004/02/09 19:38:00 albertel Exp $
 # Copyright Michigan State University Board of Trustees
 #
 # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
@@ -191,7 +191,7 @@
     if (!defined($ENV{'form.submitted'})) { return; }
     my %responsehash;
     my %grade;
-    my ($temp,$right,$wrong,$ignored)=(0,0,0,0);
+    my ($temp,$right,$wrong,$ignored)=(1,0,0,0);
     my @correctorder=&get_correct_order($tol,@whichfoils);
     foreach my $name (@whichfoils) {
 	my $response = &Apache::response::getresponse($temp);