--- loncom/interface/statistics/lonproblemanalysis.pm 2002/07/24 14:52:32 1.1 +++ loncom/interface/statistics/lonproblemanalysis.pm 2002/07/30 21:31:48 1.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonproblemanalysis.pm,v 1.1 2002/07/24 14:52:32 stredwic Exp $ +# $Id: lonproblemanalysis.pm,v 1.2 2002/07/30 21:31:48 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -41,6 +41,8 @@ use strict; use Apache::lonnet(); use GDBM_File; +my $jr; + sub BuildProblemAnalysisPage { my ($cacheDB)=@_; @@ -52,7 +54,7 @@ sub BuildProblemAnalysisPage { } $Str .= &IntervalOptions($cache{'Interval'}); - $Str .= &OptionResponseTable($cache{'OptionResponses'}); + $Str .= &OptionResponseTable($cache{'OptionResponses'}, \%cache); untie(%cache); @@ -60,61 +62,85 @@ sub BuildProblemAnalysisPage { } sub BuildAnalyzePage { - my ($cacheDB, $students, $courseID)=@_; + my ($cacheDB, $students, $courseID,$r)=@_; - my $Str = ''; + $jr = $r; + my $c = $r->connection; + + my $Str = ''; my %cache; + foreach (@$students) { + if($c->aborted) { + return $Str; + } + my $courseData = + &Apache::loncoursedata::DownloadCourseInformation($_, + $courseID); + if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT,0640)) { + &Apache::loncoursedata::ProcessStudentData(\%cache, + $courseData, $_); + untie(%cache); + } else { + last if($c->aborted()); + next; + } + } + unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) { $Str .= '
Unable to tie database.'; return $Str; } - my $uri = $cache{'AnalyzeURI'}, - my $part = $cache{'AnalyzePart'}, - my $problem = $cache{'AnalyzeProblem'}, - my $title = $cache{'AnalyzeTitle'}, - my $interval = $cache{'Interval'}, + my ($problemId, $part, $responseId)=split(':',$cache{'AnalyzeInfo'}); + my $uri = $cache{$problemId.':source'}; + my $problem = $cache{$problemId.':problem'}; + my $title = $cache{$problemId.':title'}; + my $interval = $cache{'Interval'}; my %ConceptData; $ConceptData{"Interval"} = $interval; #Initialize the option response true answers - my ($Concepts, $foil_to_concept, $answer) = &InitAnalysis($uri, $part, - $problem, - $students->[0], - $courseID); + my ($analyzeData) = &InitAnalysis($uri, $part, $responseId, $problem, + $students->[0], $courseID); + if(defined($analyzeData->{'error'})) { + $Str .= 'Incorrect part requested.