--- loncom/interface/statistics/lonproblemanalysis.pm 2002/07/24 14:52:32 1.1 +++ loncom/interface/statistics/lonproblemanalysis.pm 2002/08/13 14:44:33 1.6 @@ -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.6 2002/08/13 14:44:33 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -41,80 +41,111 @@ use strict; use Apache::lonnet(); use GDBM_File; +my $jr; + sub BuildProblemAnalysisPage { - my ($cacheDB)=@_; + my ($cacheDB, $r)=@_; my %cache; - my $Str = ''; - unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) { - $Str .= '
Unable to tie database.'; - return $Str; + unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { + $r->print('Unable to tie database.'); + return; } - $Str .= &IntervalOptions($cache{'Interval'}); - $Str .= &OptionResponseTable($cache{'OptionResponses'}); + $r->print(&IntervalOptions($cache{'Interval'})); + $r->rflush(); + $r->print(&OptionResponseTable($cache{'OptionResponses'}, \%cache)); untie(%cache); - return $Str; + return; } sub BuildAnalyzePage { - my ($cacheDB, $students, $courseID)=@_; + my ($cacheDB, $students, $courseID,$r)=@_; - my $Str = ''; + $jr = $r; + my $c = $r->connection; + + my $Str = ''; my %cache; - unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) { + 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.'; - return $Str; + $r->print($Str); + return; } - 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 .= $analyzeData->{'error'}.'