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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 28 Sep 2006 18:59:11 -0000


albertel		Thu Sep 28 14:59:11 2006 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - was taking time of first submission not last.
  - (-10)%60 is apparently 50
  - (some code for edit mdoe of takss...)
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.181 loncom/homework/bridgetask.pm:1.182
--- loncom/homework/bridgetask.pm:1.181	Mon Jul 17 16:35:11 2006
+++ loncom/homework/bridgetask.pm	Thu Sep 28 14:59:11 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.181 2006/07/17 20:35:11 albertel Exp $
+# $Id: bridgetask.pm,v 1.182 2006/09/28 18:59:11 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -394,6 +394,7 @@
     for (my $v=$Apache::lonhomework::history{'version'};$v>0;$v--) {
 	if (defined($Apache::lonhomework::history{$v.':resource.'.$version.'.0.bridgetask.portfiles'})) {
 	    $submissiontime=$Apache::lonhomework::history{$v.':timestamp'};
+	    last;
 	}
     }
     my $result;
@@ -404,16 +405,18 @@
 	my ($color,$when)=('#FF6666','after');
 	if ($diff > 0) { ($color,$when)=('#336600','before'); }
 	my $info;
+	$diff = abs($diff);
 	if ($diff%60) { $info=($diff%60).' seconds'; }
 	$diff=int($diff/60);
 	if ($diff%60) { $info=($diff%60).' minutes '.$info; }
 	$diff=int($diff/60);
 	if ($diff) {    $info=$diff.' hours '.$info; }
 	$result='<p><font color="'.$color.'">'.
-	    &mt('Student submitted [_1] [_2] the deadline. 
-                 (Submission was at [_3], end of period was [_4].)',
-		$info,$when,scalar(localtime($submissiontime)),
-		scalar(localtime($slot{'endtime'}))).
+	    &mt('Student submitted [_1] [_2] the deadline. '.
+		'(Submission was at [_3], end of period was [_4].)',
+		$info,$when,
+		&Apache::lonlocal::locallocaltime($submissiontime),
+		&Apache::lonlocal::locallocaltime($slot{'endtime'})).
 		'</font></p>';
     }
     return $result;
@@ -1232,6 +1235,10 @@
 						      'Partial Credit Factor');
 	$result.=&Apache::response::meta_stores_write('status','string',
 						      'Bridge Task Status');
+    } elsif ($target eq 'edit') {
+	&Apache::structuretags::reset_problem_globals('Task');
+	undef($Apache::lonhomework::parsing_a_task);
+	return ('','no');
     }
     &Apache::structuretags::reset_problem_globals('Task');
     undef($Apache::lonhomework::parsing_a_task);