--- loncom/interface/Attic/lonchart.pm 2001/11/17 20:30:47 1.10
+++ loncom/interface/Attic/lonchart.pm 2001/11/22 17:05:07 1.11
@@ -18,7 +18,7 @@
# 7/10/01 Behrouz Minaei
# 9/8 Gerd Kortemeyer
# 10/18/01, 10/19/01 Behrouz Minaei
-# 11/17/01 Behrouz Minaei
+# 11/17/01, 11/22/01 Behrouz Minaei
package Apache::lonchart;
@@ -33,6 +33,7 @@ my %hash;
my @cols;
my @rowlabels;
my @students;
+my $r;
# ------------------------------------------------------------- Find out status
@@ -74,6 +75,30 @@ sub ExtractStudentData {
next;
}
$ResId=~/(\d+)\.(\d+)/;
+ my $meta=$hash{'src_'.$ResId};
+# $r->print($m.'
');
+# $r->rflush();
+ my $PartNo = 0;
+ undef %TempHash;
+ map {
+ if ($_=~/^stores\_(\d+)\_tries$/) {
+ my $Part=&Apache::lonnet::metadata($meta,$_.'.part');
+ if ( $TempHash{"$Part"} eq '' ) {
+ $TempHash{"$Part"} = $Part;
+ $TempHash{$PartNo}=$Part;
+ $TempHash{"$Part.Code"} = ' ';
+ $PartNo++;
+ }
+ }
+ } split(/\,/,&Apache::lonnet::metadata($meta,'keys'));
+
+# foreach my $Key (%TempHash) {
+# $r->print($Key.' = '.$TempHash{$Key}.'
');
+# $r->rflush();
+# }
+
+$r->print($PartNo.'
');$r->rflush();
+
my $Prob = &Apache::lonnet::declutter( $hash{'map_id_'.$1} ).
'___'.$2.'___'.
&Apache::lonnet::declutter( $hash{'src_'.$ResId} );
@@ -81,8 +106,8 @@ sub ExtractStudentData {
$Tries = 0;
$LatestVersion = $result{"version:$Prob"};
- undef %TempHash;
- my $PartNo = 0;
+ #undef %TempHash;
+ #my $PartNo = 0;
if ( $LatestVersion ) {
for ( my $Version=1; $Version<=$LatestVersion; $Version++ ) {
@@ -91,12 +116,12 @@ sub ExtractStudentData {
foreach my $Key (@keys) {
if (($Key=~/\.(\w+)\.solved$/) && ($Key!~/^\d+\:/)) {
my $Part = $1;
- if ( $TempHash{"$Part"} eq '' ) {
- $TempHash{"$Part"} = $Part;
- $TempHash{$PartNo}=$Part;
- $TempHash{"$Part.Code"} = ' ';
- $PartNo++;
- }
+ #if ( $TempHash{"$Part"} eq '' ) {
+ # $TempHash{"$Part"} = $Part;
+ #$TempHash{$PartNo}=$Part;
+ #$TempHash{"$Part.Code"} = ' ';
+ #$PartNo++;
+ #}
$TempHash{"$Part.Tries"} = $result{"$Version:$Prob:resource.$Part.tries"};
$Tries = $result{"$Version:$Prob:resource.$Part.tries"};
my $Val = $result{"$Version:$Prob:$Key"};
@@ -121,11 +146,12 @@ sub ExtractStudentData {
$Str .= $TempHash{$part.'.Code'};
}
}
- else { $Str .= ' '; }
+ else {for(my $n=0; $n<$PartNo; $n++) {$Str.=' ';}}
}
}
my $PrTot = sprintf( "%5d", $PrTotal );
- $Str .= ' '.''.$PrTot.' ';
+ $Str .= ' '.''.$PrTot.' ';
+
return $Str ;
}
@@ -176,7 +202,7 @@ sub tracetable {
# ================================================================ Main Handler
sub handler {
- my $r=shift;
+ $r=shift;
if (&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {
# ------------------------------------------- Set document type for header only