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

www lon-capa-cvs@mail.lon-capa.org
Sat, 12 Jun 2004 01:04:10 -0000


www		Fri Jun 11 21:04:10 2004 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm 
  Log:
  Addresses the more blatant forms of bug #3088, answerdate before duedate.
  Does not do the cascading.
  
  
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.27 loncom/interface/lonannounce.pm:1.28
--- loncom/interface/lonannounce.pm:1.27	Mon Feb 16 20:46:34 2004
+++ loncom/interface/lonannounce.pm	Fri Jun 11 21:04:10 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.27 2004/02/17 01:46:34 www Exp $
+# $Id: lonannounce.pm,v 1.28 2004/06/12 01:04:10 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -92,9 +92,26 @@
 		    $realm=&mt('Resource').': '.&Apache::lonnet::gettitle($middle);
 		}
 		my $datetype='';
-		if ($name eq 'duedate') { $datetype=&mt('Due'); }
+		if ($name eq 'duedate') { 
+		    $datetype=&mt('Due'); 
+# see if accidentally answerdate is before duedate
+		    my $answerkey=$thiskey;
+		    $answerkey=~s/duedate$/answerdate/;
+		    if ($resourcedata{$thiskey}>$resourcedata{$answerkey}) {
+			$datetype='Due and Answer Available';
+		    }
+		}
 		if ($name eq 'opendate') { $datetype=&mt('Opening'); }
-		if ($name eq 'answerdate') { $datetype=&mt('Answer Available'); }
+		if ($name eq 'answerdate') {
+# see if accidentally answerdate is before duedate
+		    my $duekey=$thiskey;
+		    $duekey=~s/answerdate$/duedate/;
+		    if ($resourcedata{$duekey}>$resourcedata{$thiskey}) {
+# forget it
+			next;
+		    } 
+		    $datetype=&mt('Answer Available'); 
+		}
 		$returnhash{$courseid.'@'.$resourcedata{$thiskey}.'_'.
 			    $resourcedata{$thiskey}}=
 			    'INTERNAL:'.$datetype.': '.$realm.' ('.$section.')';