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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 03 Jan 2008 22:49:57 -0000


raeburn		Thu Jan  3 17:49:57 2008 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  bug 5560.  Passing $res->opendate($part) to &timeToHumanString(), was causing two arguments to be passed (a UNIX time and 'resource'). Passing $open causes just a time to be passed, so the second arg is really $type (start or end), and $format is correct.
  
  Doing the same for $res->duedate($part) and $res->answerdate(), in case they develop the same pathology.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.406 loncom/interface/lonnavmaps.pm:1.407
--- loncom/interface/lonnavmaps.pm:1.406	Tue Nov 20 12:53:46 2007
+++ loncom/interface/lonnavmaps.pm	Thu Jan  3 17:49:56 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.406 2007/11/20 17:53:46 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.407 2008/01/03 22:49:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -187,6 +187,10 @@
     my $part = shift;
     my $status = $res->status($part);
 
+    my $open = $res->opendate($part);
+    my $due = $res->duedate($part);
+    my $answer = $res->answerdate($part);
+
     if ($status == $res->NETWORK_FAILURE) { 
         return &mt("Having technical difficulties; please check status later"); 
     }
@@ -194,27 +198,27 @@
         return &mt("Not currently assigned.");
     }
     if ($status == $res->OPEN_LATER) {
-        return "Open " . timeToHumanString($res->opendate($part),'start');
+        return "Open " .timeToHumanString($open,'start');
     }
     if ($status == $res->OPEN) {
-        if ($res->duedate($part)) {
+        if ($due) {
 	    if ($res->is_practice()) {
-		return &mt("Closes ")."  " .timeToHumanString($res->duedate($part),'start');
+		return &mt("Closes ")."  " .timeToHumanString($due,'start');
 	    } else {
-		return &mt("Due")."  " .timeToHumanString($res->duedate($part),'end');
+		return &mt("Due")."  " .timeToHumanString($due,'end');
 	    }
         } else {
             return &mt("Open, no due date");
         }
     }
     if ($status == $res->PAST_DUE_ANSWER_LATER) {
-        return &mt("Answer open")." " . timeToHumanString($res->answerdate($part),'start');
+        return &mt("Answer open")." " .timeToHumanString($answer,'start');
     }
     if ($status == $res->PAST_DUE_NO_ANSWER) {
 	if ($res->is_practice()) {
-	    return &mt("Closed")." " . timeToHumanString($res->duedate($part),'start');
+	    return &mt("Closed")." " . timeToHumanString($due,'start');
 	} else {
-	    return &mt("Was due")." " . timeToHumanString($res->duedate($part),'end');
+	    return &mt("Was due")." " . timeToHumanString($due,'end');
 	}
     }
     if (($status == $res->ANSWER_OPEN || $status == $res->PARTIALLY_CORRECT)
@@ -237,8 +241,8 @@
                 $triesString = "<b>$triesString</b>";
             }
         }
-        if ($res->duedate($part)) {
-            return &mt("Due")." " . timeToHumanString($res->duedate($part),'end') .
+        if ($due) {
+            return &mt("Due")." " . timeToHumanString($due,'end') .
                 " $triesString";
         } else {
             return &mt("No due date")." $triesString";