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

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 23 Jun 2004 20:50:27 -0000


matthew		Wed Jun 23 16:50:27 2004 EDT

  Modified files:              
    /loncom/interface/statistics	lonstathelpers.pm 
  Log:
  Fixed bug where caches would not be updated/checked if the user changed
  the selected enrollment status.  Now updates/checks caches if the section
  or enrollment status is changed.
  
  
Index: loncom/interface/statistics/lonstathelpers.pm
diff -u loncom/interface/statistics/lonstathelpers.pm:1.15 loncom/interface/statistics/lonstathelpers.pm:1.16
--- loncom/interface/statistics/lonstathelpers.pm:1.15	Tue Jun 15 10:43:45 2004
+++ loncom/interface/statistics/lonstathelpers.pm	Wed Jun 23 16:50:26 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstathelpers.pm,v 1.15 2004/06/15 14:43:45 matthew Exp $
+# $Id: lonstathelpers.pm,v 1.16 2004/06/23 20:50:26 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1073,24 +1073,39 @@
 sub manage_caches {
     my ($r,$formname,$inputname) = @_;
     &Apache::loncoursedata::clear_internal_caches();
+    my $sectionkey = 
+        join(',',
+             map {
+                     &Apache::lonnet::escape($_);
+                 } sort(@Apache::lonstatistics::SelectedSections)
+             );
+    my $statuskey = $Apache::lonstatistics::enrollment_status;
     if (exists($ENV{'form.ClearCache'}) || 
-        exists($ENV{'form.updatecaches'}) ||
-        (exists($ENV{'form.firstrun'}) &&
-         $ENV{'form.firstrun'} ne 'no')) {
+        exists($ENV{'form.updatecaches'}) || 
+        (exists($ENV{'form.firstrun'}) && $ENV{'form.firstrun'} ne 'no') ||
+        (exists($ENV{'form.prevsection'}) &&
+            $ENV{'form.prevsection'} ne $sectionkey) ||
+        (exists($ENV{'form.prevenrollstatus'}) &&
+            $ENV{'form.prevenrollstatus'} ne $statuskey)
+        ) {
         &Apache::lonstatistics::Gather_Full_Student_Data($r,$formname,
                                                          $inputname);
     }
     #
+    my @Buttons = 
+        ('<input type="submit" name="ClearCache" '.
+             'value="'.&mt('Clear Caches').'" />',
+         '<input type="submit" name="updatecaches" '.
+             'value="'.&mt('Update Caches').'" />',
+         '<input type="hidden" name="prevsection" value="'.$sectionkey.'" />',
+         '<input type="hidden" name="prevenrollstatus" value="'.$statuskey.'" />'
+         );
+    #
     if (! exists($ENV{'form.firstrun'})) {
         $r->print('<input type="hidden" name="firstrun" value="yes" />');
     } else {
         $r->print('<input type="hidden" name="firstrun" value="no" />');
     }
-    my @Buttons = 
-        ('<input type="submit" name="ClearCache" '.
-             'value="'.&mt('Clear Caches').'" />',
-         '<input type="submit" name="updatecaches" '.
-             'value="'.&mt('Update Caches').'" />');
     #
     return @Buttons;
 }