--- loncom/interface/statistics/lonproblemstatistics.pm 2002/08/14 21:51:51 1.28 +++ loncom/interface/statistics/lonproblemstatistics.pm 2002/08/15 13:54:13 1.29 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonproblemstatistics.pm,v 1.28 2002/08/14 21:51:51 stredwic Exp $ +# $Id: lonproblemstatistics.pm,v 1.29 2002/08/15 13:54:13 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -123,7 +123,7 @@ sub InitializeProblemStatistics { my $problemData; if($isNotCached) { ($problemData) = &ExtractStudentData(\%cache, $students); - &CalculateStatistics($problemData, \%cache); + &CalculateStatistics($problemData, \%cache, $courseID); } untie(%cache); @@ -699,7 +699,7 @@ sub SortProblems { } sub CalculateStatistics { - my ($data, $cache)=@_; + my ($data, $cache, $courseID)=@_; my @problems = split(':::', $data->{'problemList'}); foreach(@problems) { @@ -797,6 +797,23 @@ sub CalculateStatistics { my $df2 = $upper2Sum - $lower2Sum; $data->{$_.':discriminationFactor2'} = sprintf("%.2f", $df2); + + my %storestats; + my ($sequence) = split(':', $_); + my $Average = ($data->{$_.':studentCount'}) ? + $data->{$_.':totalTries'}/$data->{$_.':studentCount'} : 0; + $storestats{$courseID.'___'.$cache->{$sequence.':source'}. + '___timestamp'}=time; + $storestats{$courseID.'___'.$cache->{$sequence.':source'}. + '___stdno'}=$data->{$_.':studentCount'}; + $storestats{$courseID.'___'.$cache->{$sequence.':source'}. + '___avetries'}=$Average; + $storestats{$courseID.'___'.$cache->{$sequence.':source'}. + '___difficulty'}=$data->{$_.':degreeOfDifficulty'}; + $cache->{$sequence.':source'} =~ /^(\w+)\/(\w+)/; + if($data->{$_.':studentCount'}) { + &Apache::lonnet::put('resevaldata',\%storestats,$1,$2); + } } return;