[LON-CAPA-cvs] cvs: loncom /interface lonspreadsheet.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Mon, 30 Sep 2002 18:03:39 -0000
matthew Mon Sep 30 14:03:39 2002 EDT
Modified files:
/loncom/interface lonspreadsheet.pm
Log:
By caching student section data we can reduce the number of calls to
lonnet::dump (via usection) by about 50%.
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.112 loncom/interface/lonspreadsheet.pm:1.113
--- loncom/interface/lonspreadsheet.pm:1.112 Fri Sep 27 16:40:19 2002
+++ loncom/interface/lonspreadsheet.pm Mon Sep 30 14:03:39 2002
@@ -1,5 +1,5 @@
#
-# $Id: lonspreadsheet.pm,v 1.112 2002/09/27 20:40:19 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.113 2002/09/30 18:03:39 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -62,6 +62,11 @@
use HTML::TokeParser;
use Apache::lonhtmlcommon;
#
+# Caches for coursewide information
+#
+my %Section;
+
+#
# Caches for previously calculated spreadsheets
#
@@ -1467,8 +1472,7 @@
$sheetdata{'sheettype'} = $stype;
$sheetdata{'usymb'} = $usymb;
$sheetdata{'cid'} = $ENV{'request.course.id'};
- $sheetdata{'csec'} = &Apache::lonnet::usection
- ($udom,$uname,$ENV{'request.course.id'});
+ $sheetdata{'csec'} = $Section{$uname.':'.$udom};
$sheetdata{'coursefilename'} = $ENV{'request.course.fn'};
$sheetdata{'cnum'} = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
$sheetdata{'cdom'} = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
@@ -1676,6 +1680,9 @@
my $cid =$sheetdata->{'cid'};
my $chome =$sheetdata->{'chome'};
#
+ %Section = ();
+
+ #
# Read class list and row labels
my %classlist;
my @tmp = &Apache::lonnet::dump('classlist',$cdom,$cnum);
@@ -1699,6 +1706,7 @@
my ($studentName,$studentDomain)=split(/\:/,$student);
my $studentSection=&Apache::lonnet::usection($studentDomain,
$studentName,$cid);
+ $Section{$studentName.':'.$studentDomain} = $studentSection;
# if ($studentSection==-1) {
# unless ($ENV{'form.showcsv'}) {
# $rowlabel='<font color=red>Data not available: '.