[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 23 May 2003 06:45:46 -0000
albertel Fri May 23 02:45:46 2003 EDT
Modified files:
/loncom/homework lonhomework.pm
Log:
- Fixes bug #1467, puts table headers on Answer distributions
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.131 loncom/homework/lonhomework.pm:1.132
--- loncom/homework/lonhomework.pm:1.131 Fri May 23 02:25:53 2003
+++ loncom/homework/lonhomework.pm Fri May 23 02:45:45 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.131 2003/05/23 06:25:53 albertel Exp $
+# $Id: lonhomework.pm,v 1.132 2003/05/23 06:45:45 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -419,14 +419,16 @@
'Analyzing Results');
foreach my $part (keys(%allparts)) {
if (defined(@{ $overall{$part.'.answer'} })) {
- $request->print('<table><tr><td>Part '.$part.'</td></tr>');
+ my $num_cols=scalar(@{ $overall{$part.'.answer'}->[0] });
+ $request->print('<table><tr><td colspan="'.($num_cols+1).'">Part '.$part.'</td></tr>');
my %frequency;
foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) {
- $frequency{join('\0',@{ $answer })}++;
+ $frequency{join("\0",@{ $answer })}++;
}
- foreach my $answer (sort {(split('\0',$a))[0] <=> (split('\0',$b))[0]} (keys(%frequency))) {
- $request->print('<tr><td>'.
- join('</td><td>',split('\0',$answer)).
+ $request->print('<tr><td colspan="'.($num_cols).'">Answer</td><td>Frequency</td></tr>');
+ foreach my $answer (sort {(split("\0",$a))[0] <=> (split("\0",$b))[0]} (keys(%frequency))) {
+ $request->print('<tr><td align="right">'.
+ join('</td><td align="right">',split("\0",$answer)).
'</td><td>('.$frequency{$answer}.
')</td></tr>');
}