[LON-CAPA-cvs] cvs: loncom /interface lonstatistics.pm /interface/statistics lonstudentassessment.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Thu, 12 Feb 2004 16:29:00 -0000
matthew Thu Feb 12 11:29:00 2004 EDT
Modified files:
/loncom/interface lonstatistics.pm
/loncom/interface/statistics lonstudentassessment.pm
Log:
Moved chart-specific code from lonstatistics to lonstudentassessment.
Reworked the width computation of chart to deal with the new output structure
and to fix Bug 2192 (titles too long in chart).
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.94 loncom/interface/lonstatistics.pm:1.95
--- loncom/interface/lonstatistics.pm:1.94 Mon Feb 2 16:45:12 2004
+++ loncom/interface/lonstatistics.pm Thu Feb 12 11:29:00 2004
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstatistics.pm,v 1.94 2004/02/02 21:45:12 matthew Exp $
+# $Id: lonstatistics.pm,v 1.95 2004/02/12 16:29:00 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -503,20 +503,6 @@
$top_map = $top if (ref($top));
@Sequences = @{$sequences} if (ref($sequences) eq 'ARRAY');
@Assessments = @{$assessments} if (ref($assessments) eq 'ARRAY');
- #
- # Compute column widths
- foreach my $seq (@Sequences) {
- my $name_length = length($seq->{'title'});
- my $num_parts = $seq->{'num_assess_parts'};
- #
- # Use 3 digits for each the sum and total, which means 7 total...
- my $num_col = $num_parts+7;
- if ($num_col < $name_length) {
- $num_col = $name_length;
- }
- $seq->{'base_width'} = $name_length;
- $seq->{'width'} = $num_col;
- }
return;
}
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.88 loncom/interface/statistics/lonstudentassessment.pm:1.89
--- loncom/interface/statistics/lonstudentassessment.pm:1.88 Thu Feb 12 09:47:55 2004
+++ loncom/interface/statistics/lonstudentassessment.pm Thu Feb 12 11:29:00 2004
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstudentassessment.pm,v 1.88 2004/02/12 14:47:55 matthew Exp $
+# $Id: lonstudentassessment.pm,v 1.89 2004/02/12 16:29:00 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -473,6 +473,7 @@
sequence_sum => 1,
sequence_max => 1,
grand_total => 1,
+ summary_table => 1,
shortdesc => 'Total Score and Maximum Possible for each '.
'Sequence or Folder',
longdesc => 'The score of each student as well as the '.
@@ -488,6 +489,7 @@
sequence_sum => 1,
sequence_max => 1,
grand_total => 1,
+ summary_table => 1,
shortdesc => 'Score on each Problem Part',
longdesc =>'The students score on each problem part, computed as'.
'the part weight * part awarded',
@@ -502,6 +504,7 @@
sequence_sum => 0,
sequence_max => 0,
grand_total => 0,
+ summary_table => 1,
shortdesc => 'Number of Tries before success on each Problem Part',
longdesc =>'The number of tries before success on each problem part.',
},
@@ -515,6 +518,7 @@
sequence_sum => 1,
sequence_max => 1,
grand_total => 1,
+ summary_table => 1,
shortdesc => 'Number of Problem Parts completed successfully.',
longdesc => 'The Number of Problem Parts completed successfully and '.
'the maximum possible for each student',
@@ -616,12 +620,43 @@
my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
$Str .= $title.' 'x($width-$base).$padding;
}
- # Now the selected sequences need to be listed
+ #
+ # Compute the column widths and output the sequence titles
foreach my $sequence (&Apache::lonstatistics::Sequences_with_Assess()){
- my $title = $sequence->{'title'};
- my $base = $sequence->{'base_width'};
- my $width = $sequence->{'width'};
- $Str .= $title.' 'x($width-$base).$padding;
+ #
+ # Comptue column widths
+ $sequence->{'width_sum'} = 0;
+ if ($chosen_output->{'sequence_sum'}) {
+ # Use 3 digits for the sum
+ $sequence->{'width_sum'} = 3;
+ }
+ if ($chosen_output->{'sequence_max'}) {
+ if ($sequence->{'width_sum'}>0) {
+ # One digit for the '/'
+ $sequence->{'width_sum'} +=1;
+ }
+ # Use 3 digits for the total
+ $sequence->{'width_sum'}+=3;
+ }
+ if ($chosen_output->{'every_problem'}) {
+ # one problem per digit
+ $sequence->{'width_problem'} = $sequence->{'num_assess_parts'};
+ } else {
+ $sequence->{'width_problem'} = 0;
+ }
+ $sequence->{'width_total'} = $sequence->{'width_problem'} +
+ $sequence->{'width_sum'};
+ if ($sequence->{'width_total'} < length($sequence->{'title'})) {
+ $sequence->{'width_total'} = length($sequence->{'title'});
+ $sequence->{'width_problem'} =
+ $sequence->{'width_total'} - $sequence->{'width_sum'};
+ }
+ #
+ # Output the sequence titles
+ $Str .=
+ $sequence->{'title'}.' 'x($sequence->{'width_total'}-
+ length($sequence->{'title'})
+ ).$padding;
}
$Str .= "total</pre>\n";
$Str .= "<pre>";
@@ -675,17 +710,22 @@
&StudentPerformanceOnSequence($student,\%StudentsData,
$seq,$show_links);
}
- my $ratio = sprintf("%3d",$score).'/'.sprintf("%3d",$seq_max);
- #
+ my $ratio='';
if ($chosen_output->{'sequence_sum'}) {
- $performance = $ratio;
- $performance .= ' 'x($seq->{'width'}-length($ratio));
- } else {
- # Pad with extra spaces
- $performance .= ' 'x($seq->{'width'}-$performance_length-
- length($ratio)
- ).$ratio;
+ $ratio .= sprintf("%3d",$score);
+ }
+ if ($chosen_output->{'sequence_max'}) {
+ if ($chosen_output->{'sequence_sum'}) {
+ $ratio .= '/';
+ }
+ $ratio .= sprintf("%3d",$seq_max);
+ }
+ #
+ if (! $chosen_output->{'every_problem'}) {
+ $performance = '';
}
+ $performance .= ' 'x($seq->{'width_problem'}-$performance_length).
+ $ratio;
#
$Str .= $performance.$padding;
#