[LON-CAPA-cvs] cvs: loncom /interface lonspreadsheet.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Wed, 20 Nov 2002 16:46:31 -0000
matthew Wed Nov 20 11:46:31 2002 EDT
Modified files:
/loncom/interface lonspreadsheet.pm
Log:
Fix bug in caching mechanism which stored away calculation time as
'uname:udom:studentcalc:time' instead of 'uname:udom:studentcalc:.time'.
Made handling of non-existant expiration times more explicit.
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.143 loncom/interface/lonspreadsheet.pm:1.144
--- loncom/interface/lonspreadsheet.pm:1.143 Tue Nov 19 17:36:09 2002
+++ loncom/interface/lonspreadsheet.pm Wed Nov 20 11:46:31 2002
@@ -1,5 +1,5 @@
#
-# $Id: lonspreadsheet.pm,v 1.143 2002/11/19 22:36:09 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.144 2002/11/20 16:46:31 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2651,7 +2651,11 @@
sub checkthis {
my ($keyname,$time)=@_;
- return ($time<$expiredates{$keyname});
+ if (! exists($expiredates{$keyname})) {
+ return 0;
+ } else {
+ return ($time<$expiredates{$keyname});
+ }
}
sub forcedrecalc {
@@ -2779,17 +2783,19 @@
#
# Store away the new value
#
+ my $timekey = $key.'.time';
if ($stype eq 'studentcalc') {
- &Apache::lonnet::put('nohist_calculatedsheets',
- { $key => $newstore,
- $key.time => $now },
- $sheet->{'cdom'},$sheet->{'cnum'});
- } else {
- &Apache::lonnet::put('nohist_calculatedsheets_'.$sheet->{'cid'},
- { $key => $newstore,
- $key.time => $now },
- $sheet->{'udom'},
- $sheet->{'uname'})
+ my $result = &Apache::lonnet::put('nohist_calculatedsheets',
+ { $key => $newstore,
+ $timekey => $now },
+ $sheet->{'cdom'},
+ $sheet->{'cnum'});
+ } else {
+ my $result = &Apache::lonnet::put('nohist_calculatedsheets_'.$sheet->{'cid'},
+ { $key => $newstore,
+ $timekey => $now },
+ $sheet->{'udom'},
+ $sheet->{'uname'});
}
return @exportarr;
}