--- loncom/interface/statistics/lonpercentage.pm 2002/12/13 21:39:19 1.3
+++ loncom/interface/statistics/lonpercentage.pm 2003/01/08 03:27:54 1.4
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# (Publication Handler
#
-# $Id: lonpercentage.pm,v 1.3 2002/12/13 21:39:19 albertel Exp $
+# $Id: lonpercentage.pm,v 1.4 2003/01/08 03:27:54 minaeibi Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -34,7 +34,6 @@ use Apache::lonhtmlcommon;
use Apache::loncoursedata;
use GDBM_File;
-#my $jr;
sub BuildPercentageGraph {
my ($cacheDB, $students, $courseID, $c, $r)=@_;
@@ -60,8 +59,8 @@ sub BuildPercentageGraph {
return;
}
- my ($Ptr, $percentage) = &GraphData(\%cache, $students);
- $r->print($Ptr.'
');
+ my ($Ptr, $percentage) = &GraphData(\%cache, $students,$r);
+ $r->print($Ptr.'
');
$r->print(&TableData(\%cache, $percentage));
@@ -186,7 +185,7 @@ sub InitializeSelectedStudents {
}
sub GraphData {
- my ($cache,$students)=@_;
+ my ($cache,$students,$r)=@_;
my $sequenceSelected = $cache->{'StatisticsMaps'};
my $problemSelected = $cache->{'StatisticsProblemSelect'};
@@ -235,7 +234,8 @@ sub GraphData {
my @percent = ();
my @percentCount = ();
my $max = 0;
- foreach my $key (sort(keys(%percentages))) {
+ my $pno = 0;
+ foreach my $key (sort NumericSort keys(%percentages)) {
push(@percent, $key);
my @temp = split(':::', $percentages{$key});
my $count = scalar(@temp);
@@ -243,12 +243,21 @@ sub GraphData {
$max = $count;
}
push(@percentCount, $count);
+ $pno++;
}
- my @GData = ('', 'Percentage', 'Number_of_Students',
- $max, scalar(@percent),
+# $r->print('
max='.$max);
+# $r->print('
percentcount='.join(',', @percentCount));
+# $r->print('
percent='.join(',', @percent));
+
+ my @GData = ('','Percentage','Number_of_Students',$max,$pno,
join(',',@percent), join(',', @percentCount));
+
+# my @GData = ('', 'Percentage', 'Number_of_Students',
+# $max, scalar(@percent),
+# join(',',@percent), join(',', @percentCount));
+
$Ptr .= ''."\n";
$Ptr .= '';
@@ -257,19 +266,29 @@ sub GraphData {
return ($Ptr, \%percentages);
}
+sub NumericSort {
+ $a <=> $b;
+}
+
sub TableData {
my($cache,$percentage)=@_;
my $Ptr;
- $Ptr .= '