--- loncom/interface/statistics/lonstudentassessment.pm 2002/08/13 00:37:18 1.8 +++ loncom/interface/statistics/lonstudentassessment.pm 2002/10/23 21:04:26 1.16 @@ -1,12 +1,11 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonstudentassessment.pm,v 1.8 2002/08/13 00:37:18 stredwic Exp $ +# $Id: lonstudentassessment.pm,v 1.16 2002/10/23 21:04:26 minaeibi Exp $ # # Copyright Michigan State University Board of Trustees # # This file is part of the LearningOnline Network with CAPA (LON-CAPA). -# # LON-CAPA is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -165,6 +164,14 @@ sub BuildStudentAssessmentPage { untie(%cache); } } + + + $r->print(&StudentReport(\%cache, "AvgTotal", $spacing, $sequenceKeys)); + $r->print("\n"); + $r->rflush(); + untie(%cache); + + $r->print(''."\n"); if($selected == 0) { $Str .= '

WARNING: '; @@ -298,7 +305,10 @@ sub StudentReport { return $Str; } + my $hasVersion = 'false'; + my $hasFinalData = 'false'; foreach my $sequence (@$showSequences) { + my $hasData = 'false'; my $characterCount=0; foreach my $problemID (split(':', $cache->{$sequence.':problems'})) { my $problem = $cache->{$problemID.':problem'}; @@ -307,12 +317,15 @@ sub StudentReport { # current problem in the correct order and prepare the output links foreach(split(/\:/,$cache->{$sequence.':'.$problemID. ':parts'})) { - $characterCount++; - if(defined($cache->{$name.':'.$problemID.':NoVersion'}) || - $cache->{$name.':'.$problemID.':'.$_.':code'} eq ' ') { + if($cache->{$name.':'.$problemID.':NoVersion'} eq 'true' || + $cache->{$name.':'.$problemID.':'.$_.':code'} eq ' ' || + $cache->{$name.':'.$problemID.':'.$_.':code'} eq '') { $Str .= ' '; + $characterCount++; next; } + $hasVersion = 'true'; + $hasData = 'true'; $Str .= '{$name.':'.$sequence. - ':problemsCorrect'}); - $Str .= ''.$outputProblemsCorrect.''; +# my $outputProblemsCorrect = sprintf("%3d", $cache->{$name.':'.$sequence. +# ':problemsCorrect'}); + + my $outputProblemsCorrect = sprintf("%2d/%2d", $cache->{$name.':'.$sequence. + ':problemsCorrect'}, + $characterCount); + if($hasData eq 'true') { + $Str .= ''.$outputProblemsCorrect.''; + $hasFinalData = 'true'; + } else { + $Str .= ' '; + } $Str .= $spacing; } @@ -345,8 +368,16 @@ sub StudentReport { # a way to dynamically determine the space requirements. my $outputProblemsSolved = sprintf("%4d", $cache->{$name.':problemsSolved'}); my $outputTotalProblems = sprintf("%4d", $cache->{$name.':totalProblems'}); - $Str .= ''.$outputProblemsSolved. + if($hasFinalData eq 'true') { + $Str .= ''.$outputProblemsSolved. ' / '.$outputTotalProblems.''; + } else { + $Str .= ' '; + } + + if($hasVersion eq 'false') { + $Str = 'No course data.'; + } return $Str; } @@ -363,14 +394,15 @@ problems. sub CreateLegend { my $Str = "

".
-              "1..9: correct by student in 1..9 tries\n".
-              "   *: correct by student in more than 9 tries\n".
-	      "   +: correct by override\n".
-              "   -: incorrect by override\n".
-	      "   .: incorrect attempted\n".
-	      "   #: ungraded attempted\n".
-              "    : not attempted\n".
-	      "   x: excused".
+              "   1  correct by student in 1 try\n".
+              "   7  correct by student in 7 tries\n".
+              "   *  correct by student in more than 9 tries\n".
+	      "   +  correct by override\n".
+              "   -  incorrect by override\n".
+	      "   .  incorrect attempted\n".
+	      "   #  ungraded attempted\n".
+              "      not attempted (blank field)\n".
+	      "   x  excused".
               "

"; return $Str; }