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

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 02 Jun 2003 18:28:37 -0000


matthew		Mon Jun  2 14:28:37 2003 EDT

  Modified files:              
    /loncom/interface/statistics	lonstudentassessment.pm 
  Log:
  Bug 1251 - get the spacing right for sequences with 0/0.
  
  
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.50 loncom/interface/statistics/lonstudentassessment.pm:1.51
--- loncom/interface/statistics/lonstudentassessment.pm:1.50	Thu May 29 17:41:10 2003
+++ loncom/interface/statistics/lonstudentassessment.pm	Mon Jun  2 14:28:37 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentassessment.pm,v 1.50 2003/05/29 21:41:10 matthew Exp $
+# $Id: lonstudentassessment.pm,v 1.51 2003/06/02 18:28:37 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -603,7 +603,7 @@
     my $studentstats;
     my $PerformanceStr = '';
     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
-        my ($performance,$score,$seq_max) =
+        my ($performance,$performance_length,$score,$seq_max) =
             &StudentPerformanceOnSequence($student,\%StudentsData,
                                           $seq,$show_links);
         my $ratio = $score.'/'.$seq_max;
@@ -616,7 +616,7 @@
             $performance .= ' 'x($seq->{'width'}-length($performance));
         } else {
             # Pad with extra spaces
-            $performance .= ' 'x($seq->{'width'}-$seq_max-
+            $performance .= ' 'x($seq->{'width'}-$performance_length-
                                  length($ratio)
                                  ).$ratio;
         }
@@ -987,7 +987,7 @@
     #
     # Write out sequence scores and totals data
     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
-        my ($performance,$score,$seq_max) =
+        my ($performance,$performance_length,$score,$seq_max) =
             &StudentPerformanceOnSequence($student,\%StudentsData,
                                           $seq,'no');
         if ($show eq 'totals' || $show eq 'scores') {
@@ -1147,7 +1147,7 @@
     #
     # Output performance data
     foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
-        my ($performance,$score,$seq_max) =
+        my ($performance,$performance_length,$score,$seq_max) =
             &StudentPerformanceOnSequence($student,\%StudentsData,
                                           $seq,'no');
         if ($show eq 'scores') {
@@ -1219,12 +1219,14 @@
     $links = 'no' if (! defined($links));
     my $Str = '';
     my ($sum,$max) = (0,0);
+    my $performance_length = 0;
     foreach my $resource (@{$seq->{'contents'}}) {
         next if ($resource->{'type'} ne 'assessment');
         my $resource_data = $studentdata->{$resource->{'symb'}};
         my $value = '';
         foreach my $partnum (@{$resource->{'parts'}}) {
             $max++;
+            $performance_length++;
             my $symbol = ' '; # default to space
             #
             if (exists($resource_data->{'resource.'.$partnum.'.solved'})) {
@@ -1266,6 +1268,9 @@
                     $symbol = ' ';
                 }
             }
+#            if ($symbol ne ' ') {
+#                $attempted_sum++;
+#            }
             #
             if ( ($links eq 'yes' && $symbol ne ' ') ||
                  ($links eq 'all')) {
@@ -1282,7 +1287,10 @@
         }
         $Str .= $value;
     }
-    return ($Str,$sum,$max);
+    if ($seq->{'randompick'}) {
+        $max = $seq->{'randompick'};
+    }
+    return ($Str,$performance_length,$sum,$max);
 }
 
 #######################################################