--- loncom/interface/statistics/lonstudentassessment.pm 2002/08/31 18:31:15 1.9
+++ loncom/interface/statistics/lonstudentassessment.pm 2002/08/31 19:25:39 1.10
@@ -1,7 +1,7 @@
# 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.10 2002/08/31 19:25:39 stredwic Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -50,7 +50,7 @@ sub BuildStudentAssessmentPage {
# $jr = $r;
my %cache;
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
- $r->print('
Unable to tie database.');
+[5~ $r->print('Unable to tie database.');
return;
}
@@ -290,8 +290,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 +298,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 +310,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.'';
+ if($hasData eq 'true') {
+ $Str .= ''.$outputProblemsCorrect.'';
+ $hasFinalData = 'true';
+ } else {
+ $Str .= ' ';
+ }
$Str .= $spacing;
}
@@ -346,8 +357,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;
}