[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet Spreadsheet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 17 May 2005 20:17:06 -0000
albertel Tue May 17 16:17:06 2005 EDT
Modified files:
/loncom/interface/spreadsheet Spreadsheet.pm
Log:
- cache the parses of the formulas when there are alot of %f it can take a while to parse through them
Index: loncom/interface/spreadsheet/Spreadsheet.pm
diff -u loncom/interface/spreadsheet/Spreadsheet.pm:1.50 loncom/interface/spreadsheet/Spreadsheet.pm:1.51
--- loncom/interface/spreadsheet/Spreadsheet.pm:1.50 Sun May 15 00:55:33 2005
+++ loncom/interface/spreadsheet/Spreadsheet.pm Tue May 17 16:17:03 2005
@@ -1,5 +1,5 @@
#
-# $Id: Spreadsheet.pm,v 1.50 2005/05/15 04:55:33 albertel Exp $
+# $Id: Spreadsheet.pm,v 1.51 2005/05/17 20:17:03 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1615,7 +1615,11 @@
my ($formulas);
if (exists($spreadsheets{$cachekey})) {
$formulas = $spreadsheets{$cachekey}->{'formulas'};
- } else {
+ $self->formulas($formulas);
+ $self->{'row_source'}=$spreadsheets{$cachekey}->{'row_source'};
+ $self->{'row_numbers'}=$spreadsheets{$cachekey}->{'row_numbers'};
+ $self->{'maxrow'}=$spreadsheets{$cachekey}->{'maxrow'};
+ } else {
# Not cached, need to read
if (! defined($filename)) {
$formulas = $self->load_system_default_sheet();
@@ -1651,10 +1655,13 @@
$filename=$self->filename(); # filename may have changed
$cachekey = join('_',($cnum,$cdom,$stype,$filename));
%{$spreadsheets{$cachekey}->{'formulas'}} = %{$formulas};
+ $self->formulas($formulas);
+ $self->set_row_sources();
+ $self->set_row_numbers();
+ %{$spreadsheets{$cachekey}->{'row_source'}} = %{$self->{'row_source'}};
+ %{$spreadsheets{$cachekey}->{'row_numbers'}} = %{$self->{'row_numbers'}};
+ $spreadsheets{$cachekey}->{'maxrow'} = $self->{'maxrow'};
}
- $self->formulas($formulas);
- $self->set_row_sources();
- $self->set_row_numbers();
}
sub set_row_sources {