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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 12 May 2006 03:46:55 -0000


albertel		Thu May 11 23:46:55 2006 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm outputtags.pm 
  Log:
  - making it easier to get the correct due_data 
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.245 loncom/homework/lonhomework.pm:1.246
--- loncom/homework/lonhomework.pm:1.245	Thu May 11 21:20:44 2006
+++ loncom/homework/lonhomework.pm	Thu May 11 23:46:54 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.245 2006/05/12 01:20:44 albertel Exp $
+# $Id: lonhomework.pm,v 1.246 2006/05/12 03:46:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -479,6 +479,20 @@
     return ($status,$datemsg);
 }
 
+sub due_date {
+    my ($part_id,$symb)=@_;
+    my $date;
+    my $interval= &Apache::lonnet::EXT("resource.$part_id.interval",$symb);
+    if ($interval) {
+	my $first_access=&Apache::lonnet::get_first_access('map',$symb);
+	if ($first_access) { $date = $first_access+$interval; }
+    }
+    if (!defined($date)) {
+	$date = &Apache::lonnet::EXT("resource.$part_id.duedate",$symb);
+    }
+    return $date
+}
+
 sub seconds_to_human_length {
     my ($length)=@_;
 
Index: loncom/homework/outputtags.pm
diff -u loncom/homework/outputtags.pm:1.47 loncom/homework/outputtags.pm:1.48
--- loncom/homework/outputtags.pm:1.47	Thu Apr 20 15:09:48 2006
+++ loncom/homework/outputtags.pm	Thu May 11 23:46:54 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # tags that create controlled output
 #
-# $Id: outputtags.pm,v 1.47 2006/04/20 19:09:48 albertel Exp $
+# $Id: outputtags.pm,v 1.48 2006/05/12 03:46:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -73,15 +73,7 @@
     }
     if (($status =~ /CAN.*_ANSWER/)) {
 	my $id = $Apache::inputtags::part;
-	my $date;
-	my $interval= &Apache::lonnet::EXT("resource.$id.interval");
-	if ($interval) {
-	    my $first_access=&Apache::lonnet::get_first_access('map');
-	    if ($first_access) { $date = $first_access+$interval; }
-	}
-	if (!defined($date)) {
-	    $date = &Apache::lonnet::EXT("resource.$id.duedate");
-	}
+	my $date = &Apache::lonhomework::due_date($id);
 	&Apache::lonxml::debug("duedatebox found $date for $id");
 
 	# Only show the due date if the current date is