--- loncom/interface/Attic/lonspreadsheet.pm 2001/01/20 01:07:03 1.34 +++ loncom/interface/Attic/lonspreadsheet.pm 2001/01/20 12:29:37 1.35 @@ -3,7 +3,7 @@ # # 11/11,11/15,11/27,12/04,12/05,12/06,12/07, # 12/08,12/09,12/11,12/12,12/15,12/16,12/18,12/19,12/30, -# 01/01/01,02/01,03/01,19/01 Gerd Kortemeyer +# 01/01/01,02/01,03/01,19/01,20/01 Gerd Kortemeyer package Apache::lonspreadsheet; @@ -25,6 +25,7 @@ my %spreadsheets; my %courserdatas; my %userrdatas; my %defaultsheets; +my %updatedata; # # These global hashes are dependent on user, course and resource, @@ -1060,6 +1061,9 @@ sub updateclasssheet { sub updatestudentassesssheet { my $safeeval=shift; my %bighash; + my $stype=&gettype($safeeval); + my %current=(); + unless ($updatedata{$ENV{'request.course.fn'}.'_'.$stype}) { # -------------------------------------------------------------------- Tie hash if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db', &GDBM_READER,0640)) { @@ -1068,8 +1072,6 @@ sub updatestudentassesssheet { my %allkeys=(); my %allassess=(); - my $stype=&gettype($safeeval); - map { if ($_=~/^src\_(\d+)\.(\d+)$/) { my $mapid=$1; @@ -1106,17 +1108,28 @@ sub updatestudentassesssheet { # %allkeys has a list of storage and parameter displays by unikey # %allassess has a list of all resource displays by symb # -# -------------------- Find discrepancies between the course row table and this -# - my %f=&getformulas($safeeval); - my $changed=0; - my %current=(); if ($stype eq 'assesscalc') { %current=%allkeys; } elsif ($stype eq 'studentcalc') { %current=%allassess; } + $updatedata{$ENV{'request.course.fn'}.'_'.$stype}= + join('___;___',%current); + undef %allkeys; + undef %allassess; + } else { + return 'Could not access course data'; + } +# ------------------------------------------------------ Get current from cache + } else { + %current=split(/\_\_\_\;\_\_\_/, + $updatedata{$ENV{'request.course.fn'}.'_'.$stype}); + } +# -------------------- Find discrepancies between the course row table and this +# + my %f=&getformulas($safeeval); + my $changed=0; my $maxrow=0; my %existing=(); @@ -1142,15 +1155,14 @@ sub updatestudentassesssheet { $f{'A'.$maxrow}=$_; } } keys %current; - + if ($changed) { &setformulas($safeeval,%f); } &setmaxrow($safeeval,$maxrow); &setrowlabels($safeeval,%current); - - } else { - return 'Could not access course data'; - } + + undef %current; + undef %existing; } # ------------------------------------------------ Load data for one assessment @@ -1194,9 +1206,7 @@ sub loadcourse { if ($_=~/^A(\d+)/) { my $row=$1; unless (($f{$_}=~/^\!/) - || ($row>200)) - { my @studentdata=&exportsheet(&getuname($safeeval), &getudom($safeeval),