--- loncom/interface/Attic/lonchart.pm 2002/07/08 15:03:25 1.57
+++ loncom/interface/Attic/lonchart.pm 2002/07/09 15:43:49 1.59
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# (Publication Handler
#
-# $Id: lonchart.pm,v 1.57 2002/07/08 15:03:25 stredwic Exp $
+# $Id: lonchart.pm,v 1.59 2002/07/09 15:43:49 stredwic Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -84,10 +84,9 @@ display options back to default values.
=head1 CODE LAYOUT DESCRIPTION
-The code is broken down into five components: formatting data for printing,
-downloading data from servers, processing data, helper functions,
-and the central processing functions. The module is broken into chunks
-for each component.
+The code is broken down into three components: formatting data for printing,
+helper functions, and the central processing functions. The module is broken
+into chunks for each component.
=head1 PACKAGES USED
@@ -105,6 +104,7 @@ use strict;
use Apache::Constants qw(:common :http);
use Apache::lonnet();
use Apache::loncommon();
+use Apache::loncoursedata();
use HTML::TokeParser;
use GDBM_File;
@@ -152,7 +152,7 @@ sub FormatStudentInformation {
my $Str='';
for(my $index=0; $index<(scalar @$studentInformation); $index++) {
- if(!&ShouldShowColumn($cache, 'heading'.$index)) {
+ if(!&ShouldShowColumn($cache, 'ChartHeading'.$index)) {
next;
}
my $data=$cache->{$name.':'.$studentInformation->[$index]};
@@ -236,7 +236,7 @@ sub FormatStudentData {
my $problemsSolved = 0;
my $numberOfParts = 0;
foreach my $sequence (split(/\:/,$CacheData{'orderedSequences'})) {
- if(!&ShouldShowColumn(\%CacheData, 'sequence'.$sequence)) {
+ if(!&ShouldShowColumn(\%CacheData, 'ChartSequence'.$sequence)) {
next;
}
@@ -245,6 +245,8 @@ sub FormatStudentData {
my $problem = $CacheData{$problemID.':problem'};
my $LatestVersion = $CacheData{$name.":version:$problem"};
+ # Output blanks for all the parts of this problem if there
+ # is no version information about the current problem.
if(!$LatestVersion) {
foreach my $part (split(/\:/,$CacheData{$sequence.':'.
$problemID.
@@ -257,13 +259,19 @@ sub FormatStudentData {
}
my %partData=undef;
- #initialize data, displays skips correctly
+ # Initialize part data, display skips correctly
+ # Skip refers to when a student made no submissions on that
+ # part/problem.
foreach my $part (split(/\:/,$CacheData{$sequence.':'.
$problemID.
':parts'})) {
$partData{$part.':tries'}=0;
$partData{$part.':code'}=' ';
}
+
+ # Looping through all the versions of each part, starting with the
+ # oldest version. Basically, it gets the most recent
+ # set of grade data for each part.
for(my $Version=1; $Version<=$LatestVersion; $Version++) {
foreach my $part (split(/\:/,$CacheData{$sequence.':'.
$problemID.
@@ -271,6 +279,7 @@ sub FormatStudentData {
if(!defined($CacheData{$name.":$Version:$problem".
":resource.$part.solved"})) {
+ # No grade for this submission, so skip
next;
}
@@ -294,6 +303,9 @@ sub FormatStudentData {
}
}
+ # All grades (except for versionless parts) are displayed as links
+ # to their submission record. Loop through all the parts for the
+ # current problem in the correct order and prepare the output links
$Str.='';
@@ -319,6 +331,9 @@ sub FormatStudentData {
$Str.='';
}
+ # Output the number of correct answers for the current sequence.
+ # This part takes up 6 character slots, but is formated right
+ # justified.
my $spacesNeeded=$CacheData{$sequence.':columnWidth'}-$characterCount;
$spacesNeeded -= 3;
$Str .= (' 'x$spacesNeeded);
@@ -331,6 +346,9 @@ sub FormatStudentData {
$Str .= $spacePadding;
}
+ # Output the total correct problems over the total number of problems.
+ # I don't like this type of formatting, but it is a solution. Need
+ # a way to dynamically determine the space requirements.
my $outputProblemsSolved = sprintf( "%4d", $problemsSolved );
my $outputTotalProblems = sprintf( "%4d", $totalProblems );
$Str .= ''.$outputProblemsSolved.
@@ -372,7 +390,7 @@ sub CreateTableHeadings {
my $Str='