--- loncom/interface/statistics/lonstudentassessment.pm 2002/12/16 23:35:46 1.21 +++ loncom/interface/statistics/lonstudentassessment.pm 2003/01/09 15:59:17 1.25 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonstudentassessment.pm,v 1.21 2002/12/16 23:35:46 minaeibi Exp $ +# $Id: lonstudentassessment.pm,v 1.25 2003/01/09 15:59:17 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -30,7 +30,7 @@ # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei # YEAR=2002 # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei -# 5/12,5/14,5/15,5/19,5/26,7/16 Behrouz Minaei +# 5/12,5/14,5/15,5/19,5/26,7/16,12/24 Behrouz Minaei # ### @@ -101,6 +101,7 @@ sub BuildStudentAssessmentPage { if($c->aborted()) { return $Str; } my $selected=0; + my $Count = 0; $r->print('
'."\n");
     foreach (@$students) {
         if($c->aborted()) { return $Str; }
@@ -132,8 +133,16 @@ sub BuildStudentAssessmentPage {
                     push(@before, $_);
                 }
             }
-            my $displayString = 'DISPLAYDATA'.$spacing;
-            $r->print(&Apache::lonhtmlcommon::FormatStudentInformation(
+            $Count++;
+	    my $out = '';
+#	    $out .= sprintf("%3d", $Count);
+            if($Count % 2) {
+                $out .= '';
+            } else {
+                $out .= '';
+            }
+	    my $displayString = $out.'DISPLAYDATA'.$spacing;
+	    $r->print(&Apache::lonhtmlcommon::FormatStudentInformation(
                                                          \%cache, $_,
                                                          \@before,
                                                          $displayString,
@@ -238,6 +247,7 @@ sub CreateTableHeadings {
     my($cache,$spacing,$infoKeys,$infoHeadings,$sequenceKeys,
        $sequenceHeadings)=@_;
 
+#    my $Str = '     ';
     my $Str = '';
     $Str .= ''."\n";
 
@@ -400,7 +410,7 @@ sub StudentReport {
 
 sub StudentAverageTotal {
     my ($cache, $students, $sequenceKeys)=@_;
-    my $Str = "\nAverageTotal\n";
+    my $Str = "\nSummary Tables:\n";
     my %Correct = ();
     my $ProblemsSolved = 0;
     my $TotalProblems = 0;
@@ -409,25 +419,78 @@ sub StudentAverageTotal {
     foreach my $name (@$students) {
         $StudentCount++;
         foreach my $sequence (@$sequenceKeys) {
-            $Correct{$cache->{$sequence.':title'}} +=
-	        $cache->{$name.':'.$sequence.':problemsCorrect'};
+            $Correct{$sequence} +=
+	       $cache->{$name.':'.$sequence.':problemsCorrect'};
         }
 	$ProblemsSolved += $cache->{$name.':problemsSolved'};
         $TotalProblems += $cache->{$name.':totalProblems'};
     }
-    $ProblemsSolved /= $StudentCount;
-    $TotalProblems /= $StudentCount;
-    $Str .= "AvgSlvd:$ProblemsSolved  AvgTotal: $TotalProblems\n";
-    
-    foreach (%Correct) {
-        $Str .= "$_  : $Correct{$_}\n";
+    if ($StudentCount) { 
+        $ProblemsSolved /= $StudentCount;
+        $TotalProblems /= $StudentCount;
+    } else {
+        $ProblemsSolved = 0;
+        $TotalProblems  = 0;
+    }
+    $Str .= '
'."\n"; + $Str .= ''."\n"; + $Str .= ''."\n"; + $Str .= ''."\n"; + $Str .= '
Students Count'. + $StudentCount.'
Total Problems'. + $TotalProblems.'
Average Correct'. + $ProblemsSolved.'
'."\n"; + + $Str .= ''."\n"; + $Str .= ''. + ''."\n"; + foreach my $S(@$sequenceKeys) { + my $title=$cache->{$S.':title'}; + #$Str .= $cache->{$S.':problems'}; + #my @problems=split(':', $cache->{$S.':problems'}); + #my $pCount=scalar @problems; + my $pCount=MaxSeqPr($cache,@$students[0],$S); + my $crr; + if ($StudentCount) { + $crr=sprintf( "%.2f", $Correct{$S}/$StudentCount ); + } else { + $crr="0.00"; + } + $Str .= ''."\n"; } + $Str .= '
TitleTotal ProblemsAverage Correct
'.$title. + ''.$pCount. + ''.$crr. + '
'."\n"; + return $Str; } +sub MaxSeqPr { + my ($cache, $name, $sequence)=@_; + my $prCount=0; + foreach my $problemID (split(':', $cache->{$sequence.':problems'})) { + my $problem = $cache->{$problemID.':problem'}; + foreach(split(/\:/,$cache->{$sequence.':'.$problemID.':parts'})) { + if($cache->{$name.':'.$problemID.':NoVersion'} eq 'true' || + $cache->{$name.':'.$problemID.':'.$_.':code'} eq ' ' || + $cache->{$name.':'.$problemID.':'.$_.':code'} eq '') { + $prCount++; + next; + } + $prCount++; + } + } + return $prCount; +} + + + + + =pod =item &CreateLegend()