--- loncom/interface/statistics/lonproblemstatistics.pm 2002/08/13 12:21:46 1.20 +++ loncom/interface/statistics/lonproblemstatistics.pm 2002/08/14 16:18:55 1.25 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonproblemstatistics.pm,v 1.20 2002/08/13 12:21:46 stredwic Exp $ +# $Id: lonproblemstatistics.pm,v 1.25 2002/08/14 16:18:55 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -52,7 +52,32 @@ sub BuildProblemStatisticsPage { $jr = $r; unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { - return '
Unable to tie database.'; + $r->print('Unable to tie database.'); + return; + } + + # Remove students who don't have the proper section. + my @sectionsSelected = split(':',$cache{'sectionsSelected'}); + for(my $studentIndex=((scalar @$students)-1); $studentIndex>=0; + $studentIndex--) { + my $value = $cache{$students->[$studentIndex].':section'}; + my $found = 0; + foreach (@sectionsSelected) { + if($_ eq 'none') { + if($value eq '' || !defined($value) || $value eq ' ') { + $found = 1; + last; + } + } else { + if($value eq $_) { + $found = 1; + last; + } + } + } + if($found == 0) { + splice(@$students, $studentIndex, 1); + } } my $Ptr = ''; @@ -69,6 +94,14 @@ sub BuildProblemStatisticsPage { 'ProblemStatistics', 'Statistics'); $Ptr .= ''."\n"; + $Ptr .= '