[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm

www lon-capa-cvs@mail.lon-capa.org
Sat, 07 Sep 2002 18:21:44 -0000


www		Sat Sep  7 14:21:44 2002 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
  Log:
  Respects time intervals for open and answer date.
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.86 loncom/homework/lonhomework.pm:1.87
--- loncom/homework/lonhomework.pm:1.86	Fri Aug 16 17:30:08 2002
+++ loncom/homework/lonhomework.pm	Sat Sep  7 14:21:44 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.86 2002/08/16 21:30:08 albertel Exp $
+# $Id: lonhomework.pm,v 1.87 2002/09/07 18:21:44 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -148,6 +148,15 @@
   foreach $temp ("opendate","duedate","answerdate") {
     $lastdate = $date;
     $date = &Apache::lonnet::EXT("resource.$id.$temp");
+    my $thistype = &Apache::lonnet::EXT("resource.$id.$temp.type");
+    if ($thistype eq 'date_interval') {
+	if ($temp eq 'opendate') {
+           $date=&Apache::lonnet::EXT("resource.$id.duedate")-$date;
+        }
+        if ($temp eq 'answerdate') {
+           $date=&Apache::lonnet::EXT("resource.$id.duedate")+$date;
+        }
+    }
     &Apache::lonxml::debug("found :$date: for :$temp:");
     if ($date eq '') {
       $date = "an unknown date"; $passed = 0;