[LON-CAPA-cvs] cvs: loncom /interface loncoursedata.pm lonstatistics.pm /interface/spreadsheet assesscalc.pm /interface/statistics lonstudentassessment.pm

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 02 Oct 2003 17:07:42 -0000


matthew		Thu Oct  2 13:07:42 2003 EDT

  Modified files:              
    /loncom/interface	loncoursedata.pm lonstatistics.pm 
    /loncom/interface/statistics	lonstudentassessment.pm 
    /loncom/interface/spreadsheet	assesscalc.pm 
  Log:
  Added loncoursedata::clear_internal_caches() and calls to it in
  &lonstatistics::Gather_Student_Data (used by statistics), 
  lonstudentassessment.pm (chart), assesscalc.pm (spreadsheet).  Should
  go into 1.0.2 if possible.
  
  
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.98 loncom/interface/loncoursedata.pm:1.99
--- loncom/interface/loncoursedata.pm:1.98	Thu Oct  2 10:11:36 2003
+++ loncom/interface/loncoursedata.pm	Thu Oct  2 13:07:41 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.98 2003/10/02 14:11:36 matthew Exp $
+# $Id: loncoursedata.pm,v 1.99 2003/10/02 17:07:41 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1066,6 +1066,36 @@
     return $students_by_id{$student_id} if(exists($students_by_id{$student_id}));
     return undef; # error
 }
+
+################################################
+################################################
+
+=pod
+
+=item &clear_internal_caches()
+
+Causes the internal caches used in get_student_id, get_student,
+get_symb_id, get_symb, get_part_id, and get_part to be undef'd.
+
+Needs to be called before the first operation with the MySQL database
+for a given Apache request.
+
+=cut
+
+################################################
+################################################
+sub clear_internal_caches {
+    $have_read_part_table = 0;
+    undef(%ids_by_part);
+    undef(%parts_by_id);
+    $have_read_symb_table = 0;
+    undef(%ids_by_symb);
+    undef(%symbs_by_id);
+    $have_read_student_table = 0;
+    undef(%ids_by_student);
+    undef(%students_by_id);
+}
+
 
 ################################################
 ################################################
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.82 loncom/interface/lonstatistics.pm:1.83
--- loncom/interface/lonstatistics.pm:1.82	Mon Sep 29 14:32:38 2003
+++ loncom/interface/lonstatistics.pm	Thu Oct  2 13:07:41 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstatistics.pm,v 1.82 2003/09/29 18:32:38 matthew Exp $
+# $Id: lonstatistics.pm,v 1.83 2003/10/02 17:07:41 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -880,6 +880,8 @@
 sub Gather_Student_Data {
     my ($r) = @_;
     my $c = $r->connection();
+    #
+    &Apache::loncoursedata::clear_internal_caches();
     #
     my @Sequences = &Apache::lonstatistics::Sequences_with_Assess();
     #
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.68 loncom/interface/statistics/lonstudentassessment.pm:1.69
--- loncom/interface/statistics/lonstudentassessment.pm:1.68	Tue Sep 30 07:41:06 2003
+++ loncom/interface/statistics/lonstudentassessment.pm	Thu Oct  2 13:07:41 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentassessment.pm,v 1.68 2003/09/30 11:41:06 matthew Exp $
+# $Id: lonstudentassessment.pm,v 1.69 2003/10/02 17:07:41 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -199,6 +199,9 @@
     #       This makes sure that parameter changes at the student level
     #       are immediately reflected in the chart.
     &Apache::lonnet::clear_EXT_cache_status();
+    #
+    # Clean out loncoursedata's package data, just to be safe.
+    &Apache::loncoursedata::clear_internal_caches();
     #
     # Call the initialize routine selected above
     $initialize->($r);
Index: loncom/interface/spreadsheet/assesscalc.pm
diff -u loncom/interface/spreadsheet/assesscalc.pm:1.24 loncom/interface/spreadsheet/assesscalc.pm:1.25
--- loncom/interface/spreadsheet/assesscalc.pm:1.24	Mon Sep 22 17:03:25 2003
+++ loncom/interface/spreadsheet/assesscalc.pm	Thu Oct  2 13:07:41 2003
@@ -1,5 +1,5 @@
 #
-# $Id: assesscalc.pm,v 1.24 2003/09/22 21:03:25 matthew Exp $
+# $Id: assesscalc.pm,v 1.25 2003/10/02 17:07:41 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -50,6 +50,7 @@
 use Apache::lonnet;
 use Apache::loncommon;
 use Apache::Spreadsheet;
+use Apache::loncoursedata();
 use HTML::Entities();
 use Spreadsheet::WriteExcel;
 use GDBM_File;
@@ -148,6 +149,7 @@
 
 sub initialize {
     &clear_package();
+    &Apache::loncoursedata::clear_internal_caches();
 }
 
 ########################################################
@@ -173,6 +175,7 @@
     }
     &load_cached_export_rows();
     &load_parameter_caches();
+    &Apache::loncoursedata::clear_internal_caches();
 }