[LON-CAPA-cvs] cvs: loncom /interface/statistics lonproblemstatistics.pm

minaeibi lon-capa-cvs@mail.lon-capa.org
Tue, 12 Nov 2002 19:52:46 -0000


minaeibi		Tue Nov 12 14:52:46 2002 EDT

  Modified files:              
    /loncom/interface/statistics	lonproblemstatistics.pm 
  Log:
  
  Fixed a bug in computing the Max value in Wrong percentage of problems. 
  (I think it relates to bug 899)
  
  CV: ----------------------------------------------------------------------
  
  
Index: loncom/interface/statistics/lonproblemstatistics.pm
diff -u loncom/interface/statistics/lonproblemstatistics.pm:1.35 loncom/interface/statistics/lonproblemstatistics.pm:1.36
--- loncom/interface/statistics/lonproblemstatistics.pm:1.35	Fri Nov  1 17:09:39 2002
+++ loncom/interface/statistics/lonproblemstatistics.pm	Tue Nov 12 14:52:46 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonproblemstatistics.pm,v 1.35 2002/11/01 22:09:39 minaeibi Exp $
+# $Id: lonproblemstatistics.pm,v 1.36 2002/11/12 19:52:46 minaeibi Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -35,7 +35,7 @@
 #
 ###
 
-package Apache::lonproblemstatistics; 
+package Apache::lonproblemstatistics;
 
 use strict;
 use Apache::lonnet();
@@ -221,7 +221,7 @@
 sub BuildGraphicChart {
     my ($graph,$cacheDB,$courseDescription,$students,$courseID,$r,$c)=@_;
     my %cache;
-    my $max = 0;
+    my $max;
     unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
         return 'Unable to tie database.7';
     }
@@ -258,11 +258,12 @@
 		&DrawGraph(\@values,$courseDescription,$title,$max,$r);
 	    }
             if($sortProblems eq 'Sort Within Sequence') {
-                $r->print('<b>'.$cache{$sequence.':title'}.'</b>');
+                $r->print('<br><b>'.$cache{$sequence.':title'}.'</b>'."\n");
             }
 
             $currentSequence = $sequence;
             @values = ();
+	    $max=0;
         }
         my $data = 0;
         if($graph eq 'DoDiffGraph') {
@@ -287,21 +288,27 @@
     my ($values,$courseDescription,$title,$Max,$r)=@_;
     my $sendValues = join(',', @$values);
     my $sendCount = scalar(@$values);
-
+    $r->print("<br>The Maximum Value is: $Max");
     if ( $Max > 1 ) {
 	if ($Max % 10) {
-	    $Max++;
+            if ( int($Max) < $Max ) {
+	    	$Max++;
+		$Max = int($Max);
+	    }
 	}
-    #(10 - $Max % 10);                                                                      
-	$Max = int($Max);
+    #(10 - $Max % 10);
     } else { $Max = 1; }
 
-    my @GData = ($courseDescription, 'Problem_number',
-                 $title, $Max, $sendCount, $sendValues);
-    $r->print('</form>'."\n");
+#    my @GData = ($courseDescription, 'Problem_number',
+#                 $title, $Max, $sendCount, $sendValues);
+    my @GData = ('','Problem_number',$title,$Max,$sendCount,$sendValues);
+
+#    $r->print('</form>'."\n");
+    $r->print('<br>'."\n");
     $r->print('<IMG src="/cgi-bin/graph.gif?'.
               (join('&', @GData)).'" border="1" />');
-    $r->print('<form>'."\n");
+#    $r->print('<form>'."\n");
+    $r->print('<br>'."\n");
 }
 
 #---- Problem Statistics Web Page ---------------------------------------
@@ -331,7 +338,7 @@
     my $count = 1;
     my $currentSequence = -1;
     foreach(@$orderedProblems) {
-        my ($sequence,$problem,$part)=split(':', $_); 
+        my ($sequence,$problem,$part)=split(':', $_);
         if($cache->{'StatisticsMaps'} ne 'All Maps'  &&
            $cache->{'StatisticsMaps'} ne $cache->{$sequence.':title'}) {
             next;