--- loncom/interface/statistics/lonproblemanalysis.pm 2002/08/13 00:37:18 1.5
+++ loncom/interface/statistics/lonproblemanalysis.pm 2002/08/14 16:18:55 1.7
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# (Publication Handler
#
-# $Id: lonproblemanalysis.pm,v 1.5 2002/08/13 00:37:18 stredwic Exp $
+# $Id: lonproblemanalysis.pm,v 1.7 2002/08/14 16:18:55 stredwic Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -39,6 +39,7 @@ package Apache::lonproblemanalysis;
use strict;
use Apache::lonnet();
+use Apache::lonhtmlcommon();
use GDBM_File;
my $jr;
@@ -48,11 +49,26 @@ sub BuildProblemAnalysisPage {
my %cache;
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
- $r->print('
Unable to tie database.');
+ $r->print('Unable to tie database.');
return;
}
- $r->print(&IntervalOptions($cache{'Interval'}));
+ my $Ptr = '';
+ $Ptr .= '';
+ $Ptr .= 'Select Sections ';
+ $Ptr .= ' '."\n";
+ $Ptr .= ''."\n";
+ my @sectionsSelected = split(':',$cache{'sectionsSelected'});
+ my @sections = split(':',$cache{'sectionList'});
+ $Ptr .= &Apache::lonhtmlcommon::MultipleSectionSelect(\@sections,
+ \@sectionsSelected,
+ 'Statistics');
+ $Ptr .= ' '."\n";
+ $Ptr .= 'Intervals '."\n";
+ $Ptr .= '';
+ $Ptr .= &IntervalOptions($cache{'Interval'});
+ $Ptr .= '
';
+ $r->print($Ptr);
$r->rflush();
$r->print(&OptionResponseTable($cache{'OptionResponses'}, \%cache));
@@ -69,17 +85,53 @@ sub BuildAnalyzePage {
my $Str = '';
my %cache;
- if(&Apache::loncoursedata::DownloadStudentCourseDataSeparate($students, 'true',
- $cacheDB, 'true',
- 'true', $courseID,
- $r, $c) ne 'OK') {
+
+ unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
+ $Str .= 'Unable to tie database.';
+ $r->print($Str);
+ return;
+ }
+
+ # Remove students who don't have the proper section.
+ my @sectionsSelected = split(':',$cache{'sectionsSelected'});
+ for(my $studentIndex=((scalar @$students)-1); $studentIndex>=0;
+ $studentIndex--) {
+ my $value = $cache{$students->[$studentIndex].':section'};
+ my $found = 0;
+ foreach (@sectionsSelected) {
+ if($_ eq 'none') {
+ if($value eq '' || !defined($value) || $value eq ' ') {
+ $found = 1;
+ last;
+ }
+ } else {
+ if($value eq $_) {
+ $found = 1;
+ last;
+ }
+ }
+ }
+ if($found == 0) {
+ splice(@$students, $studentIndex, 1);
+ }
+ }
+ untie(%cache);
+
+ if(&Apache::loncoursedata::DownloadStudentCourseDataSeparate($students,
+ 'true',
+ $cacheDB,
+ 'true',
+ 'true',
+ $courseID,
+ $r,
+ $c) ne 'OK') {
$r->print($Str);
return;
}
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
- $Str .= 'Unable to tie database.';
+ $Str .= 'Unable to tie database.';
$r->print($Str);
return;
}
@@ -160,8 +212,7 @@ sub IntervalOptions {
}
}
- my $Ptr = 'Select number of intervals '."\n".
- ''."\n";
+ my $Ptr = ''."\n";
for(my $n=1; $n<=7;$ n++) {
$Ptr .= '{$problemId.':source'};
- my $title = $cache->{$problemId.':title'};
-
- my $Temp = ''.$title.' ';
- $Str .= '';
- $Str .= ' '.$number.' ';
- $Str .= ''.$Temp.' ';
- $Str .= ''.$uri.' ';
- if($partCount{$problemId.':'.$part} < 2) {
- $Str .= ' '."\n";
- } else {
- $Str .= ' '."\n";
+ my $Str = '';
+
+ foreach my $sequence (sort(keys(%sequences))) {
+ my @optionProblems = split(':::', $sequences{$sequence});
+
+ $Str .= ''.$cache->{$sequence.':title'}.' '."\n";
+ $Str .= " '."\n";
}
- $Str .= ''."\n";
return $Str;
}
@@ -381,12 +446,7 @@ sub InitAnalysis {
'grade_domain' => $domain,
'grade_courseid' => $courseID,
'grade_symb' => $problem));
- my ($a)=&Apache::lonnet::str2hashref($Answ);
- my %b;
- foreach (keys(%$a)) {
- $b{&Apache::lonnet::unescape($_)} = $a->{$_};
- }
- my $Answer=\%b;
+ my ($Answer)=&Apache::lonnet::str2hashref($Answ);
my $found = 0;
my @parts=();