[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet Spreadsheet.pm

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 16 Jul 2003 16:48:51 -0000


matthew		Wed Jul 16 12:48:51 2003 EDT

  Modified files:              
    /loncom/interface/spreadsheet	Spreadsheet.pm 
  Log:
  Fix bug 1221: due date changes not showing up in spreadsheet.
  The issue is with expiration dates in &check_expiration_time()
  1. Was using 'usymb' when we should have been using 'symb'.
  2. We were not checking for the case in which all students have had the
     sheet associated with a given symb expired, as happens when you set
     a parameter for a problem.
  
  
Index: loncom/interface/spreadsheet/Spreadsheet.pm
diff -u loncom/interface/spreadsheet/Spreadsheet.pm:1.18 loncom/interface/spreadsheet/Spreadsheet.pm:1.19
--- loncom/interface/spreadsheet/Spreadsheet.pm:1.18	Wed Jun 25 11:33:49 2003
+++ loncom/interface/spreadsheet/Spreadsheet.pm	Wed Jul 16 12:48:51 2003
@@ -1,5 +1,5 @@
 #
-# $Id: Spreadsheet.pm,v 1.18 2003/06/25 15:33:49 matthew Exp $
+# $Id: Spreadsheet.pm,v 1.19 2003/07/16 16:48:51 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -248,18 +248,27 @@
 sub check_expiration_time {
     my $self = shift;
     my ($time)=@_;
-    my ($key1,$key2,$key3,$key4);
+    my ($key1,$key2,$key3,$key4,$key5);
+    # Description of keys
+    #
+    # key1: all sheets of this type have expired
+    # key2: all sheets of this type for this student
+    # key3: all sheets of this type in this map for this student
+    # key4: this assessment sheet for this student
+    # key5: this assessment sheet for all students
     $key1 = '::'.$self->{'type'}.':';
     $key2 = $self->{'name'}.':'.$self->{'domain'}.':'.$self->{'type'}.':';
     $key3 = $key2.$self->{'container'} if (defined($self->{'container'}));
-    $key4 = $key2.$self->{'usymb'} if (defined($self->{'usymb'}));
-    foreach my $key ($key1,$key2,$key3,$key4) {
+    $key4 = $key2.$self->{'symb'} if (defined($self->{'symb'}));
+    $key5 = $key1.$self->{'symb'} if (defined($self->{'symb'}));
+    my $returnvalue = 1; # default to okay
+    foreach my $key ($key1,$key2,$key3,$key4,$key5) {
         next if (! defined($key));
-        if (exists($expiredates{$key}) &&$expiredates{$key} > $time) {
-            return 0;
+        if (exists($expiredates{$key}) && $expiredates{$key} > $time) {
+            $returnvalue = 0; # need to recompute
         }
     }
-    return 1;
+    return $returnvalue;
 }
 
 ######################################################
@@ -1641,7 +1650,7 @@
 sub save_tmp {
     my $self = shift;
     my $filename=$ENV{'user.name'}.'_'.
-        $ENV{'user.domain'}.'_spreadsheet_'.$self->{'usymb'}.'_'.
+        $ENV{'user.domain'}.'_spreadsheet_'.$self->{'symb'}.'_'.
            $self->{'filename'};
     $filename=~s/\W/\_/g;
     $filename=$Apache::lonnet::tmpdir.$filename.'.tmp';
@@ -1661,7 +1670,7 @@
 sub load_tmp {
     my $self = shift;
     my $filename=$ENV{'user.name'}.'_'.
-        $ENV{'user.domain'}.'_spreadsheet_'.$self->{'usymb'}.'_'.
+        $ENV{'user.domain'}.'_spreadsheet_'.$self->{'symb'}.'_'.
             $self->{'filename'};
     $filename=~s/\W/\_/g;
     $filename=$Apache::lonnet::tmpdir.$filename.'.tmp';