Diff for /loncom/interface/statistics/lonproblemstatistics.pm between versions 1.70 and 1.71

version 1.70, 2004/03/07 21:42:19 version 1.71, 2004/03/23 16:35:15
Line 58  use Apache::lonstatistics; Line 58  use Apache::lonstatistics;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Spreadsheet::WriteExcel;  use Spreadsheet::WriteExcel;
 use Apache::lonstathelpers();  use Apache::lonstathelpers();
   use Time::HiRes;
 ##  ##
 ## Localization notes:  ## Localization notes:
 ##  ##
Line 168  my @Fields = ( Line 168  my @Fields = (
              sortable  => 'yes',               sortable  => 'yes',
              graphable => 'yes',               graphable => 'yes',
              long_title => 'Percent of students whose final answer is wrong' },               long_title => 'Percent of students whose final answer is wrong' },
              { name   => 'deg_of_disc',
                title  => 'Deg of Disc',
                align  => 'right',
                color  => '#FFFFE6',
                format => '%4.2f',
                sortable  => 'yes',
                graphable => 'yes',
                long_title => 'Degree of Discrimination' },
   
 );  );
   
 ###############################################  ###############################################
Line 283  sub BuildProblemStatisticsPage { Line 292  sub BuildProblemStatisticsPage {
     #      #
     &Apache::lonstatistics::PrepareClasslist();      &Apache::lonstatistics::PrepareClasslist();
     #      #
       &Apache::loncoursedata::populate_weight_table();
       #
     my ($interface,$output_mode,$show) = &CreateInterface();      my ($interface,$output_mode,$show) = &CreateInterface();
     $r->print($interface);      $r->print($interface);
     $r->print('<input type="hidden" name="statsfirstcall" value="no" />');      $r->print('<input type="hidden" name="statsfirstcall" value="no" />');
Line 849  sub get_statistics { Line 860  sub get_statistics {
     $data->{'title.link'}  = $resource->{'src'}.'?symb='.      $data->{'title.link'}  = $resource->{'src'}.'?symb='.
         &Apache::lonnet::escape($resource->{'symb'});          &Apache::lonnet::escape($resource->{'symb'});
     #      #
       $data->{'deg_of_disc'} = &compute_discrimination_factor($resource,$part,$sequence);
     return $data;      return $data;
 }  }
   
   
   ###############################################
   ###############################################
   
   =pod
   
   =item &compute_discrimination_factor()
   
   Inputs: $Resource, $Sequence
   
   Returns: integer between -1 and 1
   
   =cut
   
   ###############################################
   ###############################################
   sub compute_discrimination_factor {
       my ($resource,$part,$sequence) = @_;
       &Apache::lonnet::logthis($sequence->{'title'}.' '.$resource->{'title'});
       my @Resources;
       foreach my $res (@{$sequence->{'contents'}}) {
           next if ($res->{'symb'} eq $resource->{'symb'});
           push (@Resources,$res->{'symb'});
       }
       #
       # rank
       my $ranking = 
           &Apache::loncoursedata::rank_students_by_scores_on_resources
           (\@Resources,
            \@Apache::lonstatistics::SelectedSections,
            $Apache::lonstatistics::enrollment_status,undef);
       #
       # compute their percent scores on the problems in the sequence,
       my $number_to_grab = int(scalar(@{$ranking})/4);
       my $num_students = scalar(@{$ranking});
       my @BottomSet = map { $_->[&Apache::loncoursedata::RNK_student()]; 
                         } @{$ranking}[0..$number_to_grab];
       my @TopSet    = 
           map { 
               $_->[&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);
       my ($top_sum,$top_max) = 
           &Apache::loncoursedata::get_sum_of_scores($resource,$part,\@TopSet);
       my $deg_of_disc;
       if ($top_max == 0 || $bottom_max==0) {
           $deg_of_disc = 'nan';
       } else {
           $deg_of_disc = ($top_sum/$top_max) - ($bottom_sum/$bottom_max);
       }
       #&Apache::lonnet::logthis('    '.$top_sum.'/'.$top_max.
       #                         ' - '.$bottom_sum.'/'.$bottom_max);
       return $deg_of_disc;
   }
   
 ###############################################  ###############################################
 ###############################################  ###############################################
   

Removed from v.1.70  
changed lines
  Added in v.1.71


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