--- loncom/interface/statistics/lonproblemstatistics.pm 2002/08/01 20:49:06 1.9 +++ loncom/interface/statistics/lonproblemstatistics.pm 2002/08/06 17:38:26 1.16 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonproblemstatistics.pm,v 1.9 2002/08/01 20:49:06 stredwic Exp $ +# $Id: lonproblemstatistics.pm,v 1.16 2002/08/06 17:38:26 minaeibi Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,7 +31,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,7/25,7/29 Behrouz Minaei +# 5/12,5/14,5/15,5/19,5/26,7/16,7/25,7/29,8/5 Behrouz Minaei # ### @@ -47,7 +47,7 @@ use GDBM_File; sub BuildProblemStatisticsPage { my ($cacheDB, $students, $courseID, $c, $r)=@_; my %cache; - #my %DoDiff; + unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) { return '
Unable to tie database.'; } @@ -70,9 +70,13 @@ sub BuildProblemStatisticsPage { $Ptr .= ''; $Ptr .= &ProblemStatisticsLegend(); $r->print($Ptr); + $r->rflush(); untie(%cache); + &Create_PrgWin($r); + my $count=0; foreach (@$students) { + &Update_PrgWin(scalar(@$students),$count,$_,$r); my $courseData = &Apache::loncoursedata::DownloadCourseInformation($_, $courseID); last if ($c->aborted()); @@ -81,42 +85,59 @@ sub BuildProblemStatisticsPage { $courseData, $_); untie(%cache); } + $count++; } + &Close_PrgWin($r); if($c->aborted()) { return; } unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) { return 'Unable to tie database.'; } - my %discriminant=(); - my @list=(); - my %Discuss=&Apache::loncoursedata::LoadDiscussion($courseID); - my $index=0; - foreach (@$students) { - $index++; - #&Apache::lonstatistics::Update_PrgWin(++$index,$r); - &ExtractStudentData(\%cache, $_, \@list,\%Discuss, $r, \%discriminant); - } - #&Apache::lonstatistics::Close_PrgWin($r); - - my ($upper, $lower) = &Discriminant(\%discriminant,$r); + my %Header = (0,"Homework Sets Order",1,"#Stdnts",2,"Tries",3,"Mod", 4,"Mean",5,"#YES",6,"#yes",7,"%Wrng",8,"DoDiff", 9,"S.D.",10,"Skew.",11,"D.F.1st",12,"D.F.2nd", 13, "Disc."); my $color=&setbgcolor(0); - my %GraphDat= &BuildStatisticsTable(\%cache, $upper, $lower, \@list, - \%Header, $students, $r, $color); - untie(%cache); -} + my $state=$ENV{'form.ProblemStatisticsHeading'}; -#---- Problem Statistics Web Page --------------------------------------- + my $TempCache; + if ($state) { + $TempCache=&CacheStatisticsTable($state,\%cache,\%Header, + $r,$color); + } else { + my %discriminant=(); + my @list=(); + my %Discuss=&Apache::loncoursedata::LoadDiscussion($courseID); + my $index=0; + foreach (@$students) { + $index++; + &ExtractStudentData(\%cache, $_, \@list,\%Discuss, $r, + \%discriminant); + } + my ($upper, $lower) = &Discriminant(\%discriminant,$r); + $TempCache= &BuildStatisticsTable(\%cache, $upper, $lower, + \@list, \%Header, $students, + $r, $color); + } + untie(%cache); -sub NumericSort { - $a <=> $b; + foreach (keys %$TempCache) { + last if ($c->aborted()); + if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT,0640)) { + $cache{$_}=$TempCache->{$_}; + + untie(%cache); + } + } + if($c->aborted()) { return; } + untie(%cache); } +#---- Problem Statistics Web Page --------------------------------------- + sub CreateProblemStatisticsTableHeading { my ($displayFormat,$sequenceSource,$sequenceTitle,$headings,$r)=@_; if($displayFormat eq 'Display CSV Format') { @@ -124,10 +145,12 @@ sub CreateProblemStatisticsTableHeading $r->print($sequenceSource.'"'); return; } - - $r->print('P# | '."\n"; for(my $nIndex=0; $nIndex < (scalar (keys %$headings)); $nIndex++) { $Result .= ''.''+
+ 'Computation Progress'+ + ''+ + ' |
---|