[LON-CAPA-cvs] cvs: loncom /interface/statistics lonproblemstatistics.pm lonstudentassessment.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 26 Aug 2005 21:53:25 -0000


albertel		Fri Aug 26 17:53:25 2005 EDT

  Modified files:              
    /loncom/interface/statistics	lonproblemstatistics.pm 
                                	lonstudentassessment.pm 
  Log:
  - some stat reports were not cleaningup the navmap cglobal which menat the course hashes weren't untied
  
  
Index: loncom/interface/statistics/lonproblemstatistics.pm
diff -u loncom/interface/statistics/lonproblemstatistics.pm:1.104 loncom/interface/statistics/lonproblemstatistics.pm:1.105
--- loncom/interface/statistics/lonproblemstatistics.pm:1.104	Thu Apr  7 02:56:24 2005
+++ loncom/interface/statistics/lonproblemstatistics.pm	Fri Aug 26 17:53:23 2005
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonproblemstatistics.pm,v 1.104 2005/04/07 06:56:24 albertel Exp $
+# $Id: lonproblemstatistics.pm,v 1.105 2005/08/26 21:53:23 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -661,6 +661,11 @@
 my $navmap;
 my @sequences;
 
+sub clean_up {
+    undef($navmap);
+    undef(@sequences);
+}
+
 sub BuildProblemStatisticsPage {
     my ($r,$c)=@_;
     undef($navmap);
@@ -705,6 +710,7 @@
                       'for the first analysis.  Future analysis this session '.
                       ' will not have this delay.').
                   '</p>');
+	&clean_up();
         return;
     }
     $r->rflush();
@@ -718,6 +724,7 @@
     if (! ref($navmap)) {
         $r->print('<h1>'.&mt('A course-wide error occured.').'</h1>'.
                   '<h3>'.$navmap.'</h3>');
+	&clean_up();
         return;
     }
     if (exists($env{'form.Excel'})) {
@@ -765,6 +772,7 @@
             &output_sequence_statistics($r);
         }
     }
+    &clean_up();
     return;
 }
 
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.124 loncom/interface/statistics/lonstudentassessment.pm:1.125
--- loncom/interface/statistics/lonstudentassessment.pm:1.124	Mon Apr 18 21:28:25 2005
+++ loncom/interface/statistics/lonstudentassessment.pm	Fri Aug 26 17:53:23 2005
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentassessment.pm,v 1.124 2005/04/19 01:28:25 matthew Exp $
+# $Id: lonstudentassessment.pm,v 1.125 2005/08/26 21:53:23 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -622,17 +622,21 @@
     my @sequences;
     my $navmap; # Have to keep this around since weakref is a bit zealous
 
+sub html_cleanup {
+    undef(%prog_state);
+    undef(%width);
+    #
+    undef($navmap);
+    undef(@sequences);
+}
+
 sub html_initialize {
     my ($r) = @_;
     #
     $padding = ' 'x3;
     $count = 0;
     $nodata_count = 0;
-    undef(%prog_state);
-    undef(%width);
-    #
-    undef($navmap);
-    undef(@sequences);
+    &html_cleanup();
     ($navmap,@sequences) = 
         &Apache::lonstatistics::selected_sequences_with_assessments();
     if (! ref($navmap)) {
@@ -856,7 +860,7 @@
     }
     $r->rflush();
     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
-    undef($navmap);
+    &html_cleanup();
     return;
 }
 
@@ -963,8 +967,7 @@
 my $navmap;
 my @sequences;
 
-sub excel_initialize {
-    my ($r) = @_;
+sub excel_cleanup {
     #
     undef ($excel_sheet);
     undef ($excel_workbook);
@@ -980,6 +983,12 @@
     #
     undef($navmap);
     undef(@sequences);
+}
+
+sub excel_initialize {
+    my ($r) = @_;
+
+    &excel_cleanup();
     ($navmap,@sequences) = 
         &Apache::lonstatistics::selected_sequences_with_assessments();
     if (! ref($navmap)) {
@@ -1465,14 +1474,12 @@
 sub excel_finish {
     my ($r) = @_;
     if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) {
+	&excel_cleanup();
         return;
     }
     #
     # Write the excel file
     $excel_workbook->close();
-    my $c = $r->connection();
-    #
-    return if($c->aborted());
     #
     # Close the progress window
     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
@@ -1481,6 +1488,7 @@
     $r->print('<br />'.
               '<a href="'.$filename.'">Your Excel spreadsheet.</a>'."\n");
     $r->rflush();
+    &excel_cleanup();
     return;
 }
 
@@ -1511,10 +1519,7 @@
 my $navmap;
 my @sequences;
 
-sub csv_initialize{
-    my ($r) = @_;
-    # 
-    # Clean up
+sub csv_cleanup {
     undef($outputfile);
     undef($filename);
     undef($request_aborted);
@@ -1522,6 +1527,12 @@
     #
     undef($navmap);
     undef(@sequences);
+}
+
+sub csv_initialize{
+    my ($r) = @_;
+
+    &csv_cleanup();
     ($navmap,@sequences) = 
         &Apache::lonstatistics::selected_sequences_with_assessments();
     if (! ref($navmap)) {
@@ -1707,13 +1718,11 @@
 sub csv_finish {
     my ($r) = @_;
     if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) {
+	&csv_cleanup();
         return;
     }
     close($outputfile);
     #
-    my $c = $r->connection();
-    return if ($c->aborted());
-    #
     # Close the progress window
     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
     #
@@ -1721,6 +1730,7 @@
     $r->print('<br />'.
               '<a href="'.$filename.'">'.&mt('Your csv file.').'</a>'."\n");
     $r->rflush();
+    &csv_cleanup();
     return;
     
 }