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

raeburn raeburn at source.lon-capa.org
Fri Feb 17 14:25:57 EST 2012


raeburn		Fri Feb 17 19:25:57 2012 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  - Bug 6550.
    - Code change suggested by Stefan Dröschler.
    - Due date cached with resource object.  
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.478 loncom/interface/lonnavmaps.pm:1.479
--- loncom/interface/lonnavmaps.pm:1.478	Wed Dec 28 04:11:05 2011
+++ loncom/interface/lonnavmaps.pm	Fri Feb 17 19:25:57 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.478 2011/12/28 04:11:05 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.479 2012/02/17 19:25:57 raeburn Exp $
 
 #
 # Copyright Michigan State University Board of Trustees
@@ -3614,6 +3614,8 @@
     $self->{NAV_MAP}->{RESOURCE_CACHE}->{$self->{ID}} = $self;
     $self->{RESOURCE_ERROR} = 0;
 
+    $self->{DUEDATE_CACHE} = undef;
+
     # A hash that can be used by two-pass algorithms to store data
     # about this resource in. Not used by the resource object
     # directly.
@@ -4252,6 +4254,9 @@
 
 sub duedate {
     (my $self, my $part) = @_;
+    if (defined ($self->{DUEDATE_CACHE}->{$part})) {
+        return $self->{DUEDATE_CACHE}->{$part};
+    }
     my $date;
     my @interval=$self->parmval("interval", $part);
     my $due_date=$self->parmval("duedate", $part);
@@ -4268,6 +4273,7 @@
     } else {
 	$date = $due_date;
     }
+    $self->{DUEDATE_CACHE}->{$part} = $date;
     return $date;
 }
 sub handgrade {




More information about the LON-CAPA-cvs mailing list