--- loncom/interface/statistics/lonproblemstatistics.pm 2004/04/01 22:13:39 1.82 +++ loncom/interface/statistics/lonproblemstatistics.pm 2004/04/06 15:45:13 1.83 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemstatistics.pm,v 1.82 2004/04/01 22:13:39 matthew Exp $ +# $Id: lonproblemstatistics.pm,v 1.83 2004/04/06 15:45:13 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1451,6 +1451,26 @@ sub get_statistics { $data->{'deg_of_disc'} = &compute_discrimination_factor($resource,$part,$sequence); } + # + # Store in metadata if computations were done for all students + if ($Apache::lonstatistics::SelectedSections[0] eq 'all' && + $data->{'num_students'} > 1) { + my %storestats; + # + my $urlres=(&Apache::lonnet::decode_symb($resource->{'symb'}))[2]; + my ($dom,$user) = $urlres=~/^(\w+)\/(\w+)/; + my $preamble = $courseid.'___'.$urlres.'___'; + # + $storestats{$preamble.'timestamp'} = time; + $storestats{$preamble.'stdno'} = $data->{'num_students'}; + $storestats{$preamble.'avetries'} = $data->{'mean_tries'}; + $storestats{$preamble.'difficulty'} = $data->{'deg_of_diff'}; + if ($SelectedFields{'deg_of_disc'}) { + $storestats{$preamble.'discrimination'} = $data->{'deg_of_disc'}; + } + # + &Apache::lonnet::put('nohist_resevaldata',\%storestats,$dom,$user); + } return $data; } @@ -1478,11 +1498,13 @@ sub compute_discrimination_factor { } # # rank + my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits(); my $ranking = &Apache::loncoursedata::rank_students_by_scores_on_resources (\@Resources, \@Apache::lonstatistics::SelectedSections, - $Apache::lonstatistics::enrollment_status,undef); + $Apache::lonstatistics::enrollment_status,undef, + $starttime,$endtime); # # compute their percent scores on the problems in the sequence, my $number_to_grab = int(scalar(@{$ranking})/4); @@ -1494,9 +1516,11 @@ sub compute_discrimination_factor { $_->[&Apache::loncoursedata::RNK_student()]; } @{$ranking}[($num_students-$number_to_grab)..($num_students-1)]; my ($bottom_sum,$bottom_max) = - &Apache::loncoursedata::get_sum_of_scores($resource,$part,\@BottomSet); + &Apache::loncoursedata::get_sum_of_scores($resource,$part,\@BottomSet, + undef,$starttime,$endtime); my ($top_sum,$top_max) = - &Apache::loncoursedata::get_sum_of_scores($resource,$part,\@TopSet); + &Apache::loncoursedata::get_sum_of_scores($resource,$part,\@TopSet, + undef,$starttime,$endtime); my $deg_of_disc; if ($top_max == 0 || $bottom_max==0) { $deg_of_disc = 'nan';