--- loncom/interface/statistics/lonproblemanalysis.pm 2002/08/14 16:18:55 1.7
+++ loncom/interface/statistics/lonproblemanalysis.pm 2002/09/07 23:07:38 1.10
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# (Publication Handler
#
-# $Id: lonproblemanalysis.pm,v 1.7 2002/08/14 16:18:55 stredwic Exp $
+# $Id: lonproblemanalysis.pm,v 1.10 2002/09/07 23:07:38 minaeibi Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -26,12 +26,8 @@
# http://www.lon-capa.org/
#
# (Navigate problems for statistical reports
-# YEAR=2001
-# 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
# 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
-# 5/12,5/14,5/15,5/19,5/26,7/16 Behrouz Minaei
+# 5/12,7/26 Behrouz Minaei
#
###
@@ -70,7 +66,7 @@ sub BuildProblemAnalysisPage {
$Ptr .= '
';
$r->print($Ptr);
$r->rflush();
- $r->print(&OptionResponseTable($cache{'OptionResponses'}, \%cache));
+ $r->print(&OptionResponseTable($cache{'OptionResponses'}, \%cache, $r));
untie(%cache);
@@ -115,17 +111,21 @@ sub BuildAnalyzePage {
splice(@$students, $studentIndex, 1);
}
}
- untie(%cache);
+ unless(untie(%cache)) {
+ $r->print('Can not untie hash.');
+ $r->rflush();
+ }
- if(&Apache::loncoursedata::DownloadStudentCourseDataSeparate($students,
- 'true',
- $cacheDB,
- 'true',
- 'true',
- $courseID,
- $r,
- $c) ne 'OK') {
- $r->print($Str);
+ my $error =
+ &Apache::loncoursedata::DownloadStudentCourseDataSeparate($students,
+ 'true',
+ $cacheDB,
+ 'true',
+ 'true',
+ $courseID,
+ $r, $c);
+ if($error ne 'OK') {
+ $r->print($error.'
Error downloading course data
');
return;
}
@@ -226,24 +226,26 @@ sub IntervalOptions {
}
sub OptionResponseTable {
- my ($optionResponses,$cache)=@_;
+ my ($optionResponses,$cache,$r)=@_;
my @optionResponses=split(':::', $optionResponses);
my %partCount;
my %sequences;
+ my @orderedSequences=();
foreach(@optionResponses) {
my ($sequence, $problemId, $part, undef)=split(':',$_);
$partCount{$problemId.':'.$part}++;
if(!defined($sequences{$sequence})) {
+ push(@orderedSequences, $sequence);
$sequences{$sequence} = $_;
} else {
$sequences{$sequence} .= ':::'.$_;
}
}
-
+
my $Str = '';
- foreach my $sequence (sort(keys(%sequences))) {
+ foreach my $sequence (@orderedSequences) {
my @optionProblems = split(':::', $sequences{$sequence});
$Str .= ''.$cache->{$sequence.':title'}.''."\n";
@@ -253,7 +255,8 @@ sub OptionResponseTable {
my $count = 1;
foreach(@optionProblems) {
my (undef, $problemId, $part, $response)=
- split(':',$sequences{$sequence});
+ split(':',$optionProblems[$count-1]);
+# split(':',$sequences{$sequence});
my $uri = $cache->{$problemId.':source'};
my $title = $cache->{$problemId.':title'};