[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

www lon-capa-cvs@mail.lon-capa.org
Tue, 11 Feb 2003 16:42:28 -0000


www		Tue Feb 11 11:42:28 2003 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Expire sheets correctly when regrading
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.324 loncom/lonnet/perl/lonnet.pm:1.325
--- loncom/lonnet/perl/lonnet.pm:1.324	Mon Feb 10 15:03:13 2003
+++ loncom/lonnet/perl/lonnet.pm	Tue Feb 11 11:42:27 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.324 2003/02/10 20:03:13 www Exp $
+# $Id: lonnet.pm,v 1.325 2003/02/11 16:42:27 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1112,10 +1112,14 @@
 # ----------------------------------------------------- Devalidate Spreadsheets
 
 sub devalidate {
-    my $symb=shift;
+    my ($symb,$uname,$udom)=@_;
     my $cid=$ENV{'request.course.id'}; 
     if ($cid) {
-	my $key=$ENV{'user.name'}.':'.$ENV{'user.domain'}.':';
+# delete the stored spreadsheets for
+# - the student level sheet of this user in course's homespace
+# - the assessment level sheet for this resource 
+#   for this user in user's homespace
+	my $key=$uname.':'.$udom.':';
         my $status=
 	    &del('nohist_calculatedsheets',
 		 [$key.'studentcalc'],
@@ -1126,7 +1130,7 @@
 		 [$key.'assesscalc:'.$symb]);
         unless ($status eq 'ok ok') {
            &logthis('Could not devalidate spreadsheet '.
-                    $ENV{'user.name'}.' at '.$ENV{'user.domain'}.' for '.
+                    $uname.' at '.$udom.' for '.
 		    $symb.': '.$status);
         }
     }
@@ -1458,7 +1462,10 @@
     $symb=&symbclean($symb);
     if (!$symb) { unless ($symb=&symbread()) { return ''; } }
 
-    &devalidate($symb);
+    if (!$domain) { $domain=$ENV{'user.domain'}; }
+    if (!$stuname) { $stuname=$ENV{'user.name'}; }
+
+    &devalidate($symb,$stuname,$domain);
 
     $symb=escape($symb);
     if (!$namespace) { 
@@ -1466,8 +1473,6 @@
           return ''; 
        } 
     }
-    if (!$domain) { $domain=$ENV{'user.domain'}; }
-    if (!$stuname) { $stuname=$ENV{'user.name'}; }
     if (!$home) { $home=$ENV{'user.home'}; }
     my $namevalue='';
     foreach (keys %$storehash) {
@@ -1489,7 +1494,10 @@
     $symb=&symbclean($symb);
     if (!$symb) { unless ($symb=&symbread()) { return ''; } }
 
-    &devalidate($symb);
+    if (!$domain) { $domain=$ENV{'user.domain'}; }
+    if (!$stuname) { $stuname=$ENV{'user.name'}; }
+
+    &devalidate($symb,$stuname,$domain);
 
     $symb=escape($symb);
     if (!$namespace) { 
@@ -1497,8 +1505,6 @@
           return ''; 
        } 
     }
-    if (!$domain) { $domain=$ENV{'user.domain'}; }
-    if (!$stuname) { $stuname=$ENV{'user.name'}; }
     if (!$home) { $home=$ENV{'user.home'}; }
 
     my $namevalue='';