Diff for /loncom/interface/statistics/lonproblemanalysis.pm between versions 1.81 and 1.82

version 1.81, 2004/03/16 16:41:26 version 1.82, 2004/03/22 17:25:27
Line 160  sub BuildProblemAnalysisPage { Line 160  sub BuildProblemAnalysisPage {
                                        $ProblemData,                                         $ProblemData,
                                        \@Students);                                         \@Students);
             } elsif ($current_problem->{'resptype'} eq 'numerical') {              } elsif ($current_problem->{'resptype'} eq 'numerical') {
                     &NumericalResponseAnalysis($r,$current_problem,                  ## 
                                                $ProblemData,\@Students);                  ## analyze all responses of a problem at once
                   my $res = $current_problem->{'resource'};
                   foreach my $partid (@{$res->{'parts'}}) {
                       $current_problem->{'part'} = $partid;
                       foreach my $respid (@{$res->{'partdata'}->{$partid}->{'ResponseIds'}}) {
                           $current_problem->{'respid'}=$respid;
                           &NumericalResponseAnalysis($r,$current_problem,
                                                      $ProblemData,\@Students);
                       }
                   }
             } else {              } else {
                 $r->print('<h2>This analysis is not supported</h2>');                  $r->print('<h2>This analysis is not supported</h2>');
             }              }
Line 188  sub BuildProblemAnalysisPage { Line 197  sub BuildProblemAnalysisPage {
 sub NumericalResponseAnalysis {  sub NumericalResponseAnalysis {
     my ($r,$problem,$ProblemData,$Students) = @_;      my ($r,$problem,$ProblemData,$Students) = @_;
     my $c = $r->connection();      my $c = $r->connection();
     my ($resource,$respid) = ($problem->{'resource'},      my ($resource,$partid,$respid) = ($problem->{'resource'},
                               $problem->{'respid'});                                        $problem->{'part'},
     $r->print('Response '.$respid.'</br />');                                        $problem->{'respid'});
       #
       if (scalar(@{$resource->{'parts'}})>1) {
           if (@{$resource->{'partdata'}->{$partid}->{'ResponseIds'}}>1) {
               $r->print('<h3>'.
                         &mt('Part [_1], response [_2].',$partid,$respid).
                         '</h3>');
           } else { 
               $r->print('<h3>'.
                         &mt('Part [_1]',$partid,$respid).
                         '</h3>');
           }
       } elsif (@{$resource->{'partdata'}->{$partid}->{'ResponseIds'}}>1) {
           $r->print('<h3>'.&mt('Response [_1]',$respid).'</h3>');
       }
       #
     my $analysis_html;      my $analysis_html;
     my $PerformanceData =       my $PerformanceData = &Apache::loncoursedata::get_response_data
         &Apache::loncoursedata::get_response_data          (\@Apache::lonstatistics::SelectedSections,
         ($Students,$resource->{'symb'},$respid);           $Apache::lonstatistics::enrollment_status,
            $resource->{'symb'},$respid);
     if (! defined($PerformanceData) ||       if (! defined($PerformanceData) || 
         ref($PerformanceData) ne 'ARRAY' ) {          ref($PerformanceData) ne 'ARRAY' ) {
         $analysis_html = '<h2>'.          $analysis_html = '<h2>'.
Line 232  sub one_dimensional_plot { Line 257  sub one_dimensional_plot {
     # Compute data -> image scaling factors      # Compute data -> image scaling factors
     my $min = $Labels->[0];      my $min = $Labels->[0];
     my $max = $Labels->[-1];      my $max = $Labels->[-1];
       if ($max == $min) {
           $max =$min+1;
       }
     my $h_scale = ($width-10)/($max-$min);      my $h_scale = ($width-10)/($max-$min);
     #      #
     my $max_y = 0;      my $max_y = 0;
Line 294  sub line { Line 322  sub line {
     return qq{<line x1="$x1" y1="$y1" x2="$x2" y2="$y2" color="$color" thickness="$thickness" />$/};      return qq{<line x1="$x1" y1="$y1" x2="$x2" y2="$y2" color="$color" thickness="$thickness" />$/};
 }  }
   
   sub text {
       my ($x,$y,$color,$text,$font,$direction) = @_;
       if (! defined($font) || $font !~ /^(tiny|small|medium|large|giant)$/) {
           $font = 'medium';
       }
       if (! defined($direction) || $direction ne 'vertical') {
           $direction = '';
       }
       return qq{<text x="$x" y="$y" color="$color" font="$font" direction="$direction" >$text</text>};
   }
   
 sub rectangle {  sub rectangle {
     my ($x1,$y1,$x2,$y2,$color,$thickness,$filled) = @_;      my ($x1,$y1,$x2,$y2,$color,$thickness,$filled) = @_;
     return qq{<rectangle x1="$x1" y1="$y1" x2="$x2" y2="$y2" color="$color" thickness="$thickness" filled="$filled" />};      return qq{<rectangle x1="$x1" y1="$y1" x2="$x2" y2="$y2" color="$color" thickness="$thickness" filled="$filled" />};
Line 348  sub RadioResponseAnalysis { Line 387  sub RadioResponseAnalysis {
     my ($resource,$respid) = ($problem->{'resource'},      my ($resource,$respid) = ($problem->{'resource'},
                               $problem->{'respid'});                                $problem->{'respid'});
     my $analysis_html;      my $analysis_html;
     my $PerformanceData =       my $PerformanceData = &Apache::loncoursedata::get_response_data
         &Apache::loncoursedata::get_response_data          (\@Apache::lonstatistics::SelectedSections,
         ($Students,$resource->{'symb'},$respid);           $Apache::lonstatistics::enrollment_status,
            $resource->{'symb'},$respid);
     if (! defined($PerformanceData) ||       if (! defined($PerformanceData) || 
         ref($PerformanceData) ne 'ARRAY' ) {          ref($PerformanceData) ne 'ARRAY' ) {
         $analysis_html = '<h2>'.          $analysis_html = '<h2>'.
Line 533  sub OptionResponseAnalysis { Line 573  sub OptionResponseAnalysis {
     my ($resource,$respid) = ($problem->{'resource'},      my ($resource,$respid) = ($problem->{'resource'},
                               $problem->{'respid'});                                $problem->{'respid'});
     # Note: part data is not needed.      # Note: part data is not needed.
     my $PerformanceData =       my $PerformanceData = &Apache::loncoursedata::get_response_data
         &Apache::loncoursedata::get_response_data          (\@Apache::lonstatistics::SelectedSections,
         ($Students,$resource->{'symb'},$respid);           $Apache::lonstatistics::enrollment_status,
            $resource->{'symb'},$respid);
     if (! defined($PerformanceData) ||       if (! defined($PerformanceData) || 
         ref($PerformanceData) ne 'ARRAY' ) {          ref($PerformanceData) ne 'ARRAY' ) {
         $r->print('<h2>'.          $r->print('<h2>'.

Removed from v.1.81  
changed lines
  Added in v.1.82


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