--- loncom/interface/statistics/lonproblemstatistics.pm 2004/04/01 22:13:39 1.82 +++ loncom/interface/statistics/lonproblemstatistics.pm 2004/04/16 21:43:56 1.84 @@ -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.84 2004/04/16 21:43:56 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -55,6 +55,7 @@ use Apache::loncommon(); use Apache::lonhtmlcommon; use Apache::loncoursedata; use Apache::lonstatistics; +use LONCAPA::lonmetadata(); use Apache::lonlocal; use Spreadsheet::WriteExcel; use Apache::lonstathelpers(); @@ -1451,6 +1452,21 @@ sub get_statistics { $data->{'deg_of_disc'} = &compute_discrimination_factor($resource,$part,$sequence); } + # + # Store in metadata if computations were done for all students + if ($data->{'num_students'} > 1) { + my @Sections = @Apache::lonstatistics::SelectedSections; + my $sections = '"'.join(' ',@Sections).'"'; + $sections =~ s/&+/_/g; # Ensure no special characters + $data->{'sections'}=$sections; + $data->{'course'} = $ENV{'request.course.id'}; + my $urlres=(&Apache::lonnet::decode_symb($resource->{'symb'}))[2]; + $data->{'urlres'}=$urlres; + my %storestats = + &LONCAPA::lonmetadata::dynamic_metadata_storage($data); + my ($dom,$user) = $urlres=~/^(\w+)\/(\w+)/; + &Apache::lonnet::put('nohist_resevaldata',\%storestats,$dom,$user); + } return $data; } @@ -1478,11 +1494,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 +1512,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';