[LON-CAPA-cvs] cvs: loncom /homework matchresponse.pm rankresponse.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 06 Dec 2005 10:13:46 -0000
albertel Tue Dec 6 05:13:46 2005 EDT
Modified files:
/loncom/homework matchresponse.pm rankresponse.pm
Log:
- fixup soe exam printouts also now have correct bubble listed
Index: loncom/homework/matchresponse.pm
diff -u loncom/homework/matchresponse.pm:1.55 loncom/homework/matchresponse.pm:1.56
--- loncom/homework/matchresponse.pm:1.55 Wed Jun 22 08:03:23 2005
+++ loncom/homework/matchresponse.pm Tue Dec 6 05:13:46 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Full matching style response
#
-# $Id: matchresponse.pm,v 1.55 2005/06/22 12:03:23 albertel Exp $
+# $Id: matchresponse.pm,v 1.56 2005/12/06 10:13:46 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -296,18 +296,30 @@
$randomize,
&Apache::response::showallfoils(),
\%Apache::response::foilgroup);
- my $result=&Apache::response::answer_header('matchresponse');
my %name_letter_map;
if (defined(%{ $Apache::response::itemgroup{'name_letter_map'} })) {
%name_letter_map=
%{ $Apache::response::itemgroup{'name_letter_map'} };
}
- foreach my $name (@whichfoils) {
- my $value_name=$Apache::response::foilgroup{$name.'.value'};
- my $letter=$name_letter_map{$value_name};
- $result.=&Apache::response::answer_part('matchresponse',$letter);
+ my $result;
+ if ($Apache::lonhomework::type eq 'exam') {
+ my $i=0;
+ foreach my $name (@whichfoils) {
+ $result.=&Apache::response::answer_header('matchresponse',$i++);
+ my $value_name=$Apache::response::foilgroup{$name.'.value'};
+ my $letter=$name_letter_map{$value_name};
+ $result.=&Apache::response::answer_part('matchresponse',$letter);
+ $result.=&Apache::response::answer_footer('matchresponse');
+ }
+ } else {
+ $result=&Apache::response::answer_header('matchresponse');
+ foreach my $name (@whichfoils) {
+ my $value_name=$Apache::response::foilgroup{$name.'.value'};
+ my $letter=$name_letter_map{$value_name};
+ $result.=&Apache::response::answer_part('matchresponse',$letter);
+ }
+ $result.=&Apache::response::answer_footer('matchresponse');
}
- $result.=&Apache::response::answer_footer('matchresponse');
return $result;
}
Index: loncom/homework/rankresponse.pm
diff -u loncom/homework/rankresponse.pm:1.48 loncom/homework/rankresponse.pm:1.49
--- loncom/homework/rankresponse.pm:1.48 Wed Jun 22 08:03:23 2005
+++ loncom/homework/rankresponse.pm Tue Dec 6 05:13:46 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# rank style response
#
-# $Id: rankresponse.pm,v 1.48 2005/06/22 12:03:23 albertel Exp $
+# $Id: rankresponse.pm,v 1.49 2005/12/06 10:13:46 albertel Exp $
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
@@ -166,12 +166,25 @@
if (!defined(@{ $Apache::response::foilgroup{'names'} })) { return; }
my @names = @{ $Apache::response::foilgroup{'names'} };
my @whichfoils = &whichfoils($max,$randomize);
- my $result=&Apache::response::answer_header('rankresponse');
my @correctorder=&get_correct_order($tol,@whichfoils);
- foreach my $order (@correctorder) {
- $result.=&Apache::response::answer_part('rankresponse',$order);
+ my $result;
+ if ($Apache::lonhomework::type eq 'exam') {
+ my @alphabet = ('A'..'Z');
+ my $i=0;
+ foreach my $order (@correctorder) {
+ $result.=&Apache::response::answer_header('rankresponse',$i++);
+ $result.=&Apache::response::answer_part('rankresponse',
+ $alphabet[$order-1]);
+ $result.=&Apache::response::answer_part('rankresponse',$order);
+ $result.=&Apache::response::answer_footer('rankresponse');
+ }
+ } else {
+ $result=&Apache::response::answer_header('rankresponse');
+ foreach my $order (@correctorder) {
+ $result.=&Apache::response::answer_part('rankresponse',$order);
+ }
+ $result.=&Apache::response::answer_footer('rankresponse');
}
- $result.=&Apache::response::answer_footer('rankresponse');
return $result;
}