--- loncom/interface/loncoursedata.pm 2002/08/14 16:18:55 1.16 +++ loncom/interface/loncoursedata.pm 2002/08/14 21:51:51 1.17 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: loncoursedata.pm,v 1.16 2002/08/14 16:18:55 stredwic Exp $ +# $Id: loncoursedata.pm,v 1.17 2002/08/14 21:51:51 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1023,11 +1023,14 @@ sub DownloadStudentCourseData { if($status eq 'true') { &Apache::lonhtmlcommon::Create_PrgWin($r, $title, $heading); } - my $count=1; + + my $displayString; + my $count=0; foreach (@$students) { if($c->aborted()) { return 'Aborted'; } if($status eq 'true') { + $count++; my $displayString = $count.'/'.$studentCount.': '.$_; &Apache::lonhtmlcommon::Update_PrgWin($displayString, $r); } @@ -1062,7 +1065,6 @@ sub DownloadStudentCourseData { next; } } - $count++; } if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r); } @@ -1094,7 +1096,8 @@ sub DownloadStudentCourseDataSeparate { if($status eq 'true') { &Apache::lonhtmlcommon::Create_PrgWin($r, $title, $heading); } - my $count=1; + my $count=0; + my $displayString=''; foreach (@$students) { if($c->aborted()) { untie(%downloadData); @@ -1102,7 +1105,8 @@ sub DownloadStudentCourseDataSeparate { } if($status eq 'true') { - my $displayString = $count.'/'.$studentCount.': '.$_; + $count++; + $displayString = $count.'/'.$studentCount.': '.$_; &Apache::lonhtmlcommon::Update_PrgWin($displayString, $r); } @@ -1137,10 +1141,10 @@ sub DownloadStudentCourseDataSeparate { $downloadData{$_.':error'} = 'No course data for '.$_; } } - $count++; } if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r); } + untie(%downloadData); return &CheckForResidualDownload($cacheDB, 'true', 'true', $courseID, $r, $c); } @@ -1150,14 +1154,17 @@ sub CheckForResidualDownload { my $residualFile = '/home/httpd/perl/tmp/'.$courseID.'DownloadFile.db'; if(!-e $residualFile) { - return; + return 'File does not exist'; } my %downloadData; my %cache; - unless(tie(%downloadData,'GDBM_File',$residualFile,&GDBM_READER(),0640) && - tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) { - return; + unless(tie(%downloadData,'GDBM_File',$residualFile,&GDBM_READER(),0640)) { + return 'Can not tie database for check for residual download: tempDB'; + } + unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) { + untie(%downloadData); + return 'Can not tie database for check for residual download: cacheDB'; } my @dataKeys=keys(%downloadData);