--- loncom/interface/loncoursedata.pm 2002/08/28 22:02:47 1.23 +++ loncom/interface/loncoursedata.pm 2002/08/28 22:42:15 1.24 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: loncoursedata.pm,v 1.23 2002/08/28 22:02:47 stredwic Exp $ +# $Id: loncoursedata.pm,v 1.24 2002/08/28 22:42:15 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1095,8 +1095,6 @@ sub DownloadStudentCourseData { my $title = 'LON-CAPA Statistics'; my $heading = 'Download and Process Course Data'; my $studentCount = scalar(@$students); - my %cache; - my $WhatIWant; $WhatIWant = '(^version:|'; @@ -1113,6 +1111,8 @@ sub DownloadStudentCourseData { my $displayString; my $count=0; foreach (@$students) { + my %cache; + if($c->aborted()) { return 'Aborted'; } if($status eq 'true') { @@ -1130,27 +1130,28 @@ sub DownloadStudentCourseData { if($c->aborted()) { return 'Aborted'; } - if($downloadTime eq 'Not downloaded') { - my $courseData = - &DownloadCourseInformation($_, $courseID, $downloadTime, - $WhatIWant); - if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) { - foreach my $key (keys(%$courseData)) { - if($key =~ /^(con_lost|error|no_such_host)/i) { - $courseData->{$_.':error'} = 'No course data for '.$_; - last; - } - } - if($extract eq 'true') { - &ExtractStudentData($courseData, \%cache, \%cache, $_); - } else { - &ProcessStudentData(\%cache, $courseData, $_); - } - untie(%cache); - } else { - next; - } - } + if($downloadTime ne 'Not downloaded') { + next; + } + my $courseData = + &DownloadCourseInformation($_, $courseID, $downloadTime, + $WhatIWant); + if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) { + foreach my $key (keys(%$courseData)) { + if($key =~ /^(con_lost|error|no_such_host)/i) { + $courseData->{$_.':error'} = 'No course data for '.$_; + last; + } + } + if($extract eq 'true') { + &ExtractStudentData($courseData, \%cache, \%cache, $_); + } else { + &ProcessStudentData(\%cache, $courseData, $_); + } + untie(%cache); + } else { + next; + } } if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r); } @@ -1172,8 +1173,6 @@ sub DownloadStudentCourseDataSeparate { &CheckForResidualDownload($courseID, $cacheDB, $students, $c); - my %cache; - my $studentCount = scalar(@$students); if($status eq 'true') { &Apache::lonhtmlcommon::Create_PrgWin($r, $title, $heading); @@ -1191,6 +1190,7 @@ sub DownloadStudentCourseDataSeparate { &Apache::lonhtmlcommon::Update_PrgWin($displayString, $r); } + my %cache; my $downloadTime='Not downloaded'; if($checkDate eq 'true' && tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {