Diff for /loncom/interface/statistics/lonproblemstatistics.pm between versions 1.34 and 1.35

version 1.34, 2002/10/30 18:37:00 version 1.35, 2002/11/01 22:09:39
Line 30 Line 30
 # 5/5,7/9,7/25/1,8/11,9/13,9/26,10/5,10/9,10/22,10/26 Behrouz Minaei  # 5/5,7/9,7/25/1,8/11,9/13,9/26,10/5,10/9,10/22,10/26 Behrouz Minaei
 # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei  # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei
 # YEAR=2002  # YEAR=2002
 # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei  # 1/22,2/1,2/6,2/25,3/2,3/26,4/7,5/6 Behrouz Minaei
 # 5/12,5/14,5/15,5/19,5/26,7/16,7/25,7/29,8/5  Behrouz Minaei  # 5/12,5/26,7/16,7/29,8/5,10/31  Behrouz Minaei
 #  #
 ###  ###
   
Line 43  use Apache::lonhtmlcommon; Line 43  use Apache::lonhtmlcommon;
 use Apache::loncoursedata;  use Apache::loncoursedata;
 use GDBM_File;  use GDBM_File;
   
 my $jr;  
   
 sub InitializeProblemStatistics {  sub InitializeProblemStatistics {
     my ($cacheDB, $students, $courseID, $c, $r)=@_;      my ($cacheDB, $students, $courseID, $c, $r)=@_;
     my %cache;      my %cache;
   
     $jr = $r;  
   
     unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {      unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
         $r->print('Unable to tie database1.');          $r->print('Unable to tie database1.');
         return ('ERROR', undef);          return ('ERROR', undef);
Line 229  sub BuildGraphicChart { Line 226  sub BuildGraphicChart {
         return 'Unable to tie database.7';          return 'Unable to tie database.7';
     }      }
   
 #    my @problems = split(':::', $cache{'problemList'});  
   
     my $title = '';      my $title = '';
     if($graph eq 'DoDiffGraph') {      if($graph eq 'DoDiffGraph') {
  $title = 'Degree-of-Difficulty';   $title = 'Degree-of-Difficulty';
Line 238  sub BuildGraphicChart { Line 233  sub BuildGraphicChart {
  $title = 'Wrong-Percentage';   $title = 'Wrong-Percentage';
     }      }
   
   
  #   foreach (@problems) {  
  #       my $data = 0;  
  #       if($graph eq 'DoDiffGraph') {  
  #           $data = sprintf("%.2f", $cache{$_.':degreeOfDifficulty'}),  
  #       } else {  
  #           $data = sprintf("%.1f", $cache{$_.':percentWrong'}),  
  #       }  
  #       if($max < $data) {  
  #           $max = $data;  
  #       }  
  #       push(@values, $data);  
  #   }  
   
   
     my $count = 1;  
     my $currentSequence = -1;      my $currentSequence = -1;
     my $sortProblems = 'Sort Within Sequence';      my $sortProblems = 'Sort Within Sequence';
   
Line 269  sub BuildGraphicChart { Line 248  sub BuildGraphicChart {
         my ($sequence,$problem,$part)=split(':', $_);          my ($sequence,$problem,$part)=split(':', $_);
         if($cache{'StatisticsMaps'} ne 'All Maps'  &&          if($cache{'StatisticsMaps'} ne 'All Maps'  &&
            $cache{'StatisticsMaps'} ne $cache{$sequence.':title'}) {             $cache{'StatisticsMaps'} ne $cache{$sequence.':title'}) {
             next;               next;
         }          }
   
         if($currentSequence == -1 ||          if( $currentSequence == -1 ||
            ($sortProblems eq 'Sort Within Sequence' &&              ($sortProblems eq 'Sort Within Sequence' &&
             $currentSequence != $sequence)) {              $currentSequence != $sequence)) {
             if($currentSequence ne -1) {      if($currentSequence != -1) {
                 #$r->print('<br>finish a graph<br>');   &DrawGraph(\@values,$courseDescription,$title,$max,$r);
             }      }
             if($sortProblems eq 'Sort Within Sequence') {              if($sortProblems eq 'Sort Within Sequence') {
                 $r->print('<b>'.$cache{$sequence.':title'}.'</b>');                  $r->print('<b>'.$cache{$sequence.':title'}.'</b>');
             }              }
   
             my $sendValues = join(',', @values);  
             my $sendCount = scalar(@values);  
   
             my @GData = ($courseDescription, 'Problems',  
                          $title, $max, $sendCount, $sendValues);  
             $r->print('</form>'."\n");  
             $r->print('<IMG src="/cgi-bin/graph.gif?'.  
                       (join('&', @GData)).'" border="1" />');  
             $r->print('<form>'."\n");  
             $currentSequence = $sequence;              $currentSequence = $sequence;
             @values = ();              @values = ();
   
         }          }
         my $data = 0;          my $data = 0;
         if($graph eq 'DoDiffGraph') {          if($graph eq 'DoDiffGraph') {
Line 305  sub BuildGraphicChart { Line 274  sub BuildGraphicChart {
             $max = $data;              $max = $data;
         }          }
         push(@values, $data);          push(@values, $data);
   
     }      }
   
 #$r->print('<br>');  
   
     untie(%cache);      untie(%cache);
   
       &DrawGraph(\@values,$courseDescription,$title,$max,$r);
   
     return;      return;
 }  }
   
   
   sub DrawGraph {
       my ($values,$courseDescription,$title,$Max,$r)=@_;
       my $sendValues = join(',', @$values);
       my $sendCount = scalar(@$values);
   
       if ( $Max > 1 ) {
    if ($Max % 10) {
       $Max++;
    }
       #(10 - $Max % 10);                                                                      
    $Max = int($Max);
       } else { $Max = 1; }
   
       my @GData = ($courseDescription, 'Problem_number',
                    $title, $Max, $sendCount, $sendValues);
       $r->print('</form>'."\n");
       $r->print('<IMG src="/cgi-bin/graph.gif?'.
                 (join('&', @GData)).'" border="1" />');
       $r->print('<form>'."\n");
   }
   
 #---- Problem Statistics Web Page ---------------------------------------  #---- Problem Statistics Web Page ---------------------------------------
   
 sub CreateProblemStatisticsTableHeading {  sub CreateProblemStatisticsTableHeading {
Line 343  sub BuildStatisticsTable { Line 331  sub BuildStatisticsTable {
     my $count = 1;      my $count = 1;
     my $currentSequence = -1;      my $currentSequence = -1;
     foreach(@$orderedProblems) {      foreach(@$orderedProblems) {
         my ($sequence,$problem,$part)=split(':', $_);          my ($sequence,$problem,$part)=split(':', $_); 
         if($cache->{'StatisticsMaps'} ne 'All Maps'  &&          if($cache->{'StatisticsMaps'} ne 'All Maps'  &&
            $cache->{'StatisticsMaps'} ne $cache->{$sequence.':title'}) {             $cache->{'StatisticsMaps'} ne $cache->{$sequence.':title'}) {
             next;              next;

Removed from v.1.34  
changed lines
  Added in v.1.35


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