Diff for /loncom/interface/statistics/lonproblemstatistics.pm between versions 1.104 and 1.109

version 1.104, 2005/04/07 06:56:24 version 1.109, 2006/05/30 12:46:50
Line 60  use Apache::lonlocal; Line 60  use Apache::lonlocal;
 use Spreadsheet::WriteExcel;  use Spreadsheet::WriteExcel;
 use Apache::lonstathelpers();  use Apache::lonstathelpers();
 use Time::HiRes;  use Time::HiRes;
   use lib '/home/httpd/lib/perl/';
   use LONCAPA;
    
   
 my @StatsArray;  my @StatsArray;
 my %SeqStat;    # keys are symbs, values are hash refs  my %SeqStat;    # keys are symbs, values are hash refs
Line 608  sub CreateInterface { Line 611  sub CreateInterface {
     &parse_field_selection();      &parse_field_selection();
     #      #
     my $Str = '';      my $Str = '';
     $Str .= &Apache::lonhtmlcommon::breadcrumbs      $Str .= &Apache::lonhtmlcommon::breadcrumbs('Overall Problem Statistics',
         (undef,'Overall Problem Statistics','Statistics_Overall_Key');   'Statistics_Overall_Key');
     $Str .= '<table cellspacing="5">'."\n";      $Str .= '<table cellspacing="5">'."\n";
     $Str .= '<tr>';      $Str .= '<tr>';
     $Str .= '<td align="center"><b>'.&mt('Sections').'</b></td>';      $Str .= '<td align="center"><b>'.&mt('Sections').'</b></td>';
       $Str .= '<td align="center"><b>'.&mt('Groups').'</b></td>';
     $Str .= '<td align="center"><b>'.&mt('Enrollment Status').'</b></td>';      $Str .= '<td align="center"><b>'.&mt('Enrollment Status').'</b></td>';
     $Str .= '<td align="center"><b>'.&mt('Sequences and Folders').'</b></td>';      $Str .= '<td align="center"><b>'.&mt('Sequences and Folders').'</b></td>';
     $Str .= '<td align="center"><b>'.&mt('Statistics').'</b></td>';      $Str .= '<td align="center"><b>'.&mt('Statistics').'</b></td>';
Line 623  sub CreateInterface { Line 627  sub CreateInterface {
     $Str .= '<tr><td align="center">'."\n";      $Str .= '<tr><td align="center">'."\n";
     $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5);      $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5);
     $Str .= '</td><td align="center">';      $Str .= '</td><td align="center">';
       $Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5);
       $Str .= '</td><td align="center">';
     $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5);      $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5);
     $Str .= '</td><td align="center">';      $Str .= '</td><td align="center">';
     #      #
Line 661  Main interface to problem statistics. Line 667  Main interface to problem statistics.
 my $navmap;  my $navmap;
 my @sequences;  my @sequences;
   
   sub clean_up {
       undef($navmap);
       undef(@sequences);
   }
   
 sub BuildProblemStatisticsPage {  sub BuildProblemStatisticsPage {
     my ($r,$c)=@_;      my ($r,$c)=@_;
     undef($navmap);      undef($navmap);
Line 669  sub BuildProblemStatisticsPage { Line 680  sub BuildProblemStatisticsPage {
     my %Saveable_Parameters = ('Status' => 'scalar',      my %Saveable_Parameters = ('Status' => 'scalar',
                                'statsoutputmode' => 'scalar',                                 'statsoutputmode' => 'scalar',
                                'Section' => 'array',                                 'Section' => 'array',
                                  'Groups' => 'array',
                                'StudentData' => 'array',                                 'StudentData' => 'array',
                                'Maps' => 'array',                                 'Maps' => 'array',
                                'fieldselections'=> 'array');                                 'fieldselections'=> 'array');
Line 705  sub BuildProblemStatisticsPage { Line 717  sub BuildProblemStatisticsPage {
                       'for the first analysis.  Future analysis this session '.                        'for the first analysis.  Future analysis this session '.
                       ' will not have this delay.').                        ' will not have this delay.').
                   '</p>');                    '</p>');
    &clean_up();
         return;          return;
     }      }
     $r->rflush();      $r->rflush();
Line 718  sub BuildProblemStatisticsPage { Line 731  sub BuildProblemStatisticsPage {
     if (! ref($navmap)) {      if (! ref($navmap)) {
         $r->print('<h1>'.&mt('A course-wide error occured.').'</h1>'.          $r->print('<h1>'.&mt('A course-wide error occured.').'</h1>'.
                   '<h3>'.$navmap.'</h3>');                    '<h3>'.$navmap.'</h3>');
    &clean_up();
         return;          return;
     }      }
     if (exists($env{'form.Excel'})) {      if (exists($env{'form.Excel'})) {
Line 765  sub BuildProblemStatisticsPage { Line 779  sub BuildProblemStatisticsPage {
             &output_sequence_statistics($r);              &output_sequence_statistics($r);
         }          }
     }      }
       &clean_up();
     return;      return;
 }  }
   
Line 1302  sub Excel_output { Line 1317  sub Excel_output {
                         &Apache::lonstatistics::section_and_enrollment_description('plaintext'),                          &Apache::lonstatistics::section_and_enrollment_description('plaintext'),
                         $format->{'h3'});                          $format->{'h3'});
     $cols_output += scalar(&Apache::lonstatistics::get_selected_sections());      $cols_output += scalar(&Apache::lonstatistics::get_selected_sections());
       $cols_output += scalar(&Apache::lonstatistics::get_selected_groups());
     #      #
     # Time restrictions      # Time restrictions
     my $time_string;      my $time_string;
Line 1543  sub get_statistics { Line 1559  sub get_statistics {
     #      #
     my $data = &Apache::loncoursedata::get_problem_statistics      my $data = &Apache::loncoursedata::get_problem_statistics
                         ([&Apache::lonstatistics::get_selected_sections()],                          ([&Apache::lonstatistics::get_selected_sections()],
                            [&Apache::lonstatistics::get_selected_groups()],
                          $Apache::lonstatistics::enrollment_status,                           $Apache::lonstatistics::enrollment_status,
                          $symb,$part,$courseid,$starttime,$endtime);                           $symb,$part,$courseid,$starttime,$endtime);
     $data->{'symb'}        = $symb;      $data->{'symb'}        = $symb;
Line 1551  sub get_statistics { Line 1568  sub get_statistics {
     $data->{'container'}   = $sequence->compTitle;      $data->{'container'}   = $sequence->compTitle;
     $data->{'title'}       = $resource->compTitle;      $data->{'title'}       = $resource->compTitle;
     $data->{'title.link'}  = $resource->src.'?symb='.      $data->{'title.link'}  = $resource->src.'?symb='.
         &Apache::lonnet::escape($resource->symb);          &escape($resource->symb);
     #      #
     if ($SelectedFields{'deg_of_disc'}) {      if ($SelectedFields{'deg_of_disc'}) {
         $data->{'deg_of_disc'} =           $data->{'deg_of_disc'} = 
Line 1621  sub compute_discrimination_factor { Line 1638  sub compute_discrimination_factor {
         &Apache::loncoursedata::rank_students_by_scores_on_resources          &Apache::loncoursedata::rank_students_by_scores_on_resources
         (\@Resources,          (\@Resources,
          [&Apache::lonstatistics::get_selected_sections()],           [&Apache::lonstatistics::get_selected_sections()],
            [&Apache::lonstatistics::get_selected_groups()],
          $Apache::lonstatistics::enrollment_status,undef,           $Apache::lonstatistics::enrollment_status,undef,
          $starttime,$endtime);           $starttime,$endtime, $symb);
     #      #
     # compute their percent scores on the problems in the sequence,      # compute their percent scores on the problems in the sequence,
     my $number_to_grab = int(scalar(@{$ranking})/4);      my $number_to_grab = int(scalar(@{$ranking})/4);
Line 1632  sub compute_discrimination_factor { Line 1650  sub compute_discrimination_factor {
     my @TopSet    =       my @TopSet    = 
         map {           map { 
             $_->[&Apache::loncoursedata::RNK_student()];               $_->[&Apache::loncoursedata::RNK_student()]; 
           } @{$ranking}[($num_students-$number_to_grab)..($num_students-1)];            } @{$ranking}[-$number_to_grab..0];
     if (! @BottomSet || (@BottomSet == 1 && $BottomSet[0] eq '') ||      if (! @BottomSet || (@BottomSet == 1 && $BottomSet[0] eq '') ||
         ! @TopSet    || (@TopSet    == 1 && $TopSet[0]    eq '')) {          ! @TopSet    || (@TopSet    == 1 && $TopSet[0]    eq '')) {
         return 'nan';          return 'nan';
Line 1686  sub compute_sequence_statistics { Line 1704  sub compute_sequence_statistics {
     my ($smin,$smax,$sMean,$sSTD,$scount,$sMAX) =       my ($smin,$smax,$sMean,$sSTD,$scount,$sMAX) = 
         &Apache::loncoursedata::score_stats          &Apache::loncoursedata::score_stats
                     ([&Apache::lonstatistics::get_selected_sections()],                      ([&Apache::lonstatistics::get_selected_sections()],
                        [&Apache::lonstatistics::get_selected_groups()],
                      $Apache::lonstatistics::enrollment_status,                       $Apache::lonstatistics::enrollment_status,
                      \@Resources,$starttime,$endtime,undef);                       \@Resources,$starttime,$endtime,undef);
     $SeqStat{$symb}->{'title'}  = $seq->compTitle;      $SeqStat{$symb}->{'title'}  = $seq->compTitle;
Line 1701  sub compute_sequence_statistics { Line 1720  sub compute_sequence_statistics {
     my ($cmin,$cmax,$cMean,$cSTD,$ccount)=      my ($cmin,$cmax,$cMean,$cSTD,$ccount)=
         &Apache::loncoursedata::count_stats          &Apache::loncoursedata::count_stats
         ([&Apache::lonstatistics::get_selected_sections()],          ([&Apache::lonstatistics::get_selected_sections()],
            [&Apache::lonstatistics::get_selected_groups()],
          $Apache::lonstatistics::enrollment_status,           $Apache::lonstatistics::enrollment_status,
          \@Resources,$starttime,$endtime,undef);           \@Resources,$starttime,$endtime,undef);
     my $K = $part_count;      my $K = $part_count;

Removed from v.1.104  
changed lines
  Added in v.1.109


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>