[LON-CAPA-cvs] cvs: loncom /interface/statistics lonstudentassessment.pm

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 13 Jul 2004 15:03:34 -0000


matthew		Tue Jul 13 11:03:34 2004 EDT

  Modified files:              
    /loncom/interface/statistics	lonstudentassessment.pm 
  Log:
  Make total sum adjust to width of total.
  
  
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.101 loncom/interface/statistics/lonstudentassessment.pm:1.102
--- loncom/interface/statistics/lonstudentassessment.pm:1.101	Tue May 18 13:43:36 2004
+++ loncom/interface/statistics/lonstudentassessment.pm	Tue Jul 13 11:03:34 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentassessment.pm,v 1.101 2004/05/18 17:43:36 matthew Exp $
+# $Id: lonstudentassessment.pm,v 1.102 2004/07/13 15:03:34 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -607,6 +607,7 @@
 
     my $nodata_count; # The number of students for which there is no data
     my %prog_state;   # progress state used by loncommon PrgWin routines
+    my $total_sum_width;
 
 sub html_initialize {
     my ($r) = @_;
@@ -633,6 +634,7 @@
     }
     #
     # Compute the column widths and output the sequence titles
+    my $total_count;
     foreach my $sequence (&Apache::lonstatistics::Sequences_with_Assess()){
         #
         # Comptue column widths
@@ -642,6 +644,7 @@
                 # Use 1 digit for a space
                 $sequence->{'width_sum'} += 1;            
             }
+	    $total_count += $sequence->{'num_assess_parts'};
             # Use 3 digits for the sum
             $sequence->{'width_sum'} += 3;
         }
@@ -672,7 +675,8 @@
                                       length($sequence->{'title'})
                                       ).$padding;
     }
-    $Str .= "total</pre>\n";
+    $total_sum_width = length($total_count)+1;
+    $Str .= "    total</pre>\n";
     $Str .= "<pre>";
     $r->print($Str);
     $r->rflush();
@@ -767,9 +771,9 @@
         $max   += $seq_stats->{'max'};
     }
     if (! defined($score)) {
-        $score = ' 'x3;
+        $score = ' ' x $total_sum_width;
     }
-    $Str .= ' '.' 'x(length($max)-length($score)).$score.'/'.$max;
+    $Str .= ' '.' 'x($total_sum_width-length($score)).$score.' / '.$max;
     $Str .= " \n";
     #
     $r->print($Str);