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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 20 Apr 2007 01:54:29 -0000


albertel		Thu Apr 19 21:54:29 2007 EDT

  Modified files:              
    /loncom/interface	lonnavdisplay.pm 
  Log:
  - bug#4718, problems with no due date set were mucking with the  show first due homework
  
  
Index: loncom/interface/lonnavdisplay.pm
diff -u loncom/interface/lonnavdisplay.pm:1.1 loncom/interface/lonnavdisplay.pm:1.2
--- loncom/interface/lonnavdisplay.pm:1.1	Tue Oct 10 16:16:26 2006
+++ loncom/interface/lonnavdisplay.pm	Thu Apr 19 21:54:29 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavdisplay.pm,v 1.1 2006/10/10 20:16:26 albertel Exp $
+# $Id: lonnavdisplay.pm,v 1.2 2007/04/20 01:54:29 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -37,6 +37,7 @@
 use Apache::lonhtmlcommon();
 use Apache::lonnet;
 use Apache::lonlocal;
+use Time::HiRes qw( gettimeofday tv_interval );
 
 sub handler {
     my $r = shift;
@@ -224,19 +225,19 @@
         my $curRes;
         my $foundDoableProblem = 0;
         my $minimumduedate;
-        
+        my $now = time();
+	
         while ($curRes = $iterator->next()) {
             if (ref($curRes) && $curRes->is_problem()) {
                 my $status = $curRes->status();
-                if ($curRes->completable()) {
-                    my $thisduedate=$curRes->duedate();
-                    unless ($foundDoableProblem) {
-                        $minimumduedate=$thisduedate;
-		    }
+		my $thisduedate=$curRes->duedate();
+                if ($thisduedate > $now 
+		    && $curRes->completable()) {
                         
                     $foundDoableProblem = 1;
 
-                    if ($thisduedate<=$minimumduedate) {
+                    if (!defined($minimumduedate)
+                        || $thisduedate<$minimumduedate) {
 			# Pop open all previous maps
 			my $stack = $iterator->getStack();
 			pop @$stack; # last resource in the stack is the problem