[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 13 Jan 2005 21:45:09 -0000
albertel Thu Jan 13 16:45:09 2005 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
- first access times, was stroing increbily stupid stuff, as it didn't note the courseid or the symb (it used resource url or map url)
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.587 loncom/lonnet/perl/lonnet.pm:1.588
--- loncom/lonnet/perl/lonnet.pm:1.587 Tue Jan 11 17:12:22 2005
+++ loncom/lonnet/perl/lonnet.pm Thu Jan 13 16:45:08 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.587 2005/01/11 22:12:22 albertel Exp $
+# $Id: lonnet.pm,v 1.588 2005/01/13 21:45:08 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1758,19 +1758,27 @@
my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser();
if ($argsymb) { $symb=$argsymb; }
my ($map,$id,$res)=&decode_symb($symb);
- if ($type eq 'map') { $res=$map; }
- my %times=&get('firstaccesstimes',[$res],$udom,$uname);
- return $times{$res};
+ if ($type eq 'map') {
+ $res=&symbread($map);
+ } else {
+ $res=$symb;
+ }
+ my %times=&get('firstaccesstimes',["$courseid\0$res"],$udom,$uname);
+ return $times{"$courseid\0$res"};
}
sub set_first_access {
my ($type)=@_;
my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser();
my ($map,$id,$res)=&decode_symb($symb);
- if ($type eq 'map') { $res=$map; }
- my $firstaccess=&get_first_access($type);
+ if ($type eq 'map') {
+ $res=&symbread($map);
+ } else {
+ $res=$symb;
+ }
+ my $firstaccess=&get_first_access($type,$symb);
if (!$firstaccess) {
- return &put('firstaccesstimes',{$res=>time},$udom,$uname);
+ return &put('firstaccesstimes',{"$courseid\0$res"=>time},$udom,$uname);
}
return 'already_set';
}