--- loncom/interface/loncoursedata.pm 2003/03/03 21:52:24 1.55 +++ loncom/interface/loncoursedata.pm 2003/03/05 14:39:08 1.56 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncoursedata.pm,v 1.55 2003/03/03 21:52:24 albertel Exp $ +# $Id: loncoursedata.pm,v 1.56 2003/03/05 14:39:08 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1580,9 +1580,14 @@ sub get_current_state { # $courseid = $ENV{'request.course.id'} if (! defined($courseid)); # +# my $cachefilename = $Apache::lonnet::tmpdir.$ENV{'user.name'}.'_'. +# $ENV{'user.domain'}.'_'. +# $courseid.'_student_data.db'; my $cachefilename = $Apache::lonnet::tmpdir.$ENV{'user.name'}.'_'. $ENV{'user.domain'}.'_'. - $courseid.'_student_data.db'; + $courseid.'_'. + $sname.'_'.$sdom. + '_student_data.db'; my %cache; # my %student_data; # return values go here @@ -1594,18 +1599,16 @@ sub get_current_state { if (tie(%cache,'GDBM_File',$cachefilename,&GDBM_READER(),0640)) { if (exists($cache{$key.'time'})) { $updatetime = $cache{$key.'time'}; -# &Apache::lonnet::logthis('got updatetime of '.$updatetime); } untie(%cache); } - # timestamp/devalidation + # timestamp/devalidation check should go here. my $modifiedtime = 1; # Take whatever steps are neccessary at this point to give $modifiedtime a # new value # if (($updatetime < $modifiedtime) || (defined($forcedownload) && $forcedownload)) { -# &Apache::lonnet::logthis("loading data"); # Get all the students current data my $time_of_retrieval = time; my @tmp = &Apache::lonnet::currentdump($courseid,$sdom,$sname); @@ -1627,7 +1630,6 @@ sub get_current_state { # keys instead of unescaping every key. # if (tie(%cache,'GDBM_File',$cachefilename,&GDBM_WRCREAT(),0640)) { -# &Apache::lonnet::logthis("writing data"); while (my ($current_symb,$param_hash) = each(%student_data)) { my @Parameters = %{$param_hash}; my $value = join(':',map { &Apache::lonnet::escape($_); } @@ -1639,7 +1641,6 @@ sub get_current_state { untie(%cache); } } else { - &Apache::lonnet::logthis('retrieving cached data '); if (tie(%cache,'GDBM_File',$cachefilename,&GDBM_READER(),0640)) { if (defined($symb)) { my $searchkey = $key.&Apache::lonnet::escape($symb); @@ -1652,7 +1653,6 @@ sub get_current_state { if ($testkey =~ /$searchkey/) { # \Q \E? May be necc. my $tmpsymb = $1; next if ($tmpsymb =~ 'time'); -# &Apache::lonnet::logthis('found '.$tmpsymb.':'); $student_data{&Apache::lonnet::unescape($tmpsymb)} = &make_into_hash($params); } @@ -1662,10 +1662,8 @@ sub get_current_state { } } if (! defined($symb)) { -# &Apache::lonnet::logthis("returning all data"); return %student_data; } elsif (exists($student_data{$symb})) { -# &Apache::lonnet::logthis("returning data for symb=".$symb); return %{$student_data{$symb}}; } else { return ();