Diff for /loncom/interface/statistics/lonpercentage.pm between versions 1.5 and 1.10

version 1.5, 2003/01/11 06:31:26 version 1.10, 2006/05/30 12:46:49
Line 1 Line 1
 # The LearningOnline Network with CAPA  # The LearningOnline Network with CAPA
 # (Publication Handler  
 #  #
 # $Id$  # $Id$
 #  #
Line 33  use strict; Line 32  use strict;
 use Apache::lonhtmlcommon;  use Apache::lonhtmlcommon;
 use Apache::loncoursedata;  use Apache::loncoursedata;
 use GDBM_File;  use GDBM_File;
   use lib '/home/httpd/lib/perl/';
   use LONCAPA;
    
   
   
 sub BuildPercentageGraph {  sub BuildPercentageGraph {
Line 110  sub CreateInterface { Line 112  sub CreateInterface {
     $Ptr .= '<td align="left">'."\n";      $Ptr .= '<td align="left">'."\n";
     my @sections = split(':',$cache->{'sectionList'});      my @sections = split(':',$cache->{'sectionList'});
     my @sectionsSelected = split(':',$cache->{'sectionsSelected'});      my @sectionsSelected = split(':',$cache->{'sectionsSelected'});
     $Ptr .= &Apache::lonhtmlcommon::MultipleSectionSelect(\@sections,      $Ptr .= &Apache::lonstatistics::SectionSelect('Section','multiple',5);
                                                           \@sectionsSelected,  
                                                           'Statistics');  
     $Ptr .= '</td></tr>'."\n";      $Ptr .= '</td></tr>'."\n";
     $Ptr .= '</table>';      $Ptr .= '</table>';
   
Line 193  sub GraphData { Line 193  sub GraphData {
   
     my %percentages;      my %percentages;
     my $Ptr = '';      my $Ptr = '';
       my $totalProblems = 0;
   
     foreach(@$students) {      foreach(@$students) {
  my $totalCorrect = 0;   my $totalCorrect = 0;
  my $totalProblems = 0;          $totalProblems = 0;
   
  foreach my $sequence (split(':',$cache->{'orderedSequences'})) {   foreach my $sequence (split(':',$cache->{'orderedSequences'})) {
     next if($cache->{$sequence.':title'} ne $sequenceSelected &&      next if($cache->{$sequence.':title'} ne $sequenceSelected &&
Line 221  sub GraphData { Line 222  sub GraphData {
  }   }
     }      }
  }   }
    my $percent;
  my $percent = sprintf("%d", ($totalProblems) ?   if ( $totalProblems >= 100 ) { 
       (($totalCorrect/$totalProblems)*100) : 0);              $percent = sprintf("%d", ($totalProblems) ?
                                 (($totalCorrect/$totalProblems)*100) : 0);
    } else {
       $percent = sprintf("%d", ($totalProblems) ? $totalCorrect : 0);
    }
  if(defined($percentages{$percent})) {   if(defined($percentages{$percent})) {
     $percentages{$percent} .= ':::'.$_;      $percentages{$percent} .= ':::'.$_;
  } else {   } else {
Line 235  sub GraphData { Line 240  sub GraphData {
     my @percentCount = ();      my @percentCount = ();
     my $max = 0;      my $max = 0;
     my $pno = 0;      my $pno = 0;
   
     foreach my $key (sort NumericSort keys(%percentages)) {      foreach my $key (sort NumericSort keys(%percentages)) {
  push(@percent, $key);   push(@percent, $key);
  my @temp = split(':::', $percentages{$key});   my @temp = split(':::', $percentages{$key});
Line 246  sub GraphData { Line 252  sub GraphData {
  $pno++;   $pno++;
     }      }
   
 #   $r->print('<br>max='.$max);  
 #   $r->print('<br> percentcount='.join(',', @percentCount));  
 #   $r->print('<br> percent='.join(',', @percent));  
   
     my $cId=0;      my $cId=0;
     my @data1=();      my @data1=();
     my @data2=();      my @data2=();
Line 264  sub GraphData { Line 266  sub GraphData {
         }          }
     }      }
   
       my $xlabel;
       my $Freq;
       if ($totalProblems >= 100 ) {
           $xlabel = 'Percentage_of_Problems_Correct';
           $Freq=101;
       } else {
           $xlabel = 'Number_of_Problems_Correct';
           $Freq = $cId;
       }
   
   #   $r->print('<br>Freq='.$Freq);
   #   $r->print('<br>max='.$max);
   #   $r->print('<br> percentcount='.join(',', @percentCount)); 
   #   $r->print('<br> percent='.join(',', @percent));
 #   $r->print('<br> percentcount='.join(',', @data1));  #   $r->print('<br> percentcount='.join(',', @data1));
 #   $r->print('<br> percent='.join(',', @data2));  #   $r->print('<br> percent='.join(',', @data2));
   
       my @GData = ("Percentage",$xlabel,
     my @GData = ('','Percentage','Number_of_Students',$max,101 ,                   'Number_of_Students',$max,$Freq,
                  join(',',@data1), join(',', @data2));                   join(',',@data1), join(',', @data2));
   
     $Ptr .= '</form>'."\n";      $Ptr .= '</form>'."\n";
Line 314  sub TableData { Line 330  sub TableData {
   
  foreach my $name (sort(split(':::', $percentage->{$_}))) {   foreach my $name (sort(split(':::', $percentage->{$_}))) {
     $Ptr .= '<a href="/adm/statistics?reportSelected=';      $Ptr .= '<a href="/adm/statistics?reportSelected=';
     $Ptr .= &Apache::lonnet::escape('Student Assessment');      $Ptr .= &escape('Student Assessment');
     $Ptr .= '&StudentAssessmentStudent=';      $Ptr .= '&StudentAssessmentStudent=';
     $Ptr .= &Apache::lonnet::escape($cache->{$name.':fullname'}).'">';      $Ptr .= &escape($cache->{$name.':fullname'}).'">';
     $Ptr .= $cache->{$name.':fullname'};      $Ptr .= $cache->{$name.':fullname'};
     $Ptr .= '</a>,&nbsp&nbsp';      $Ptr .= '</a>,&nbsp&nbsp';
         }          }

Removed from v.1.5  
changed lines
  Added in v.1.10


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