--- loncom/interface/statistics/lonstudentassessment.pm 2002/08/31 18:31:15 1.9 +++ loncom/interface/statistics/lonstudentassessment.pm 2002/10/22 16:27:39 1.15 @@ -1,12 +1,11 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonstudentassessment.pm,v 1.9 2002/08/31 18:31:15 stredwic Exp $ +# $Id: lonstudentassessment.pm,v 1.15 2002/10/22 16:27:39 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 @@ -290,8 +289,7 @@ sub StudentReport { my $Str = ''; if(defined($cache->{$name.':error'})) { - return '


'; -# return 'ERROR in student report for '.$name.'
'; + return $Str; } if($cache->{$name.':error'} =~ /course/) { $Str .= 'No course data for student '; @@ -299,7 +297,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'}; @@ -308,12 +309,15 @@ sub StudentReport { # current problem in the correct order and prepare the output links foreach(split(/\:/,$cache->{$sequence.':'.$problemID. ':parts'})) { - $characterCount++; if($cache->{$name.':'.$problemID.':NoVersion'} eq 'true' || - $cache->{$name.':'.$problemID.':'.$_.':code'} eq ' ') { + $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; } @@ -346,8 +360,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; } @@ -364,14 +386,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; }