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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 01 Mar 2002 00:23:04 -0000


albertel		Thu Feb 28 19:23:04 2002 EDT

  Modified files:              
    /loncom/homework	inputtags.pm structuretags.pm 
  Log:
  - addressing bug #64, Now submissions after the deadline get a message that says "The last submission was after the Due Date"
  
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.52 loncom/homework/inputtags.pm:1.53
--- loncom/homework/inputtags.pm:1.52	Wed Jan 30 12:32:42 2002
+++ loncom/homework/inputtags.pm	Thu Feb 28 19:23:04 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.52 2002/01/30 17:32:42 albertel Exp $
+# $Id: inputtags.pm,v 1.53 2002/03/01 00:23:04 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -292,9 +292,15 @@
 sub setgradedata {
   my ($award,$id,$previously_used) = @_;
   # if the student already has it correct, don't modify the status
-  if ( $Apache::lonhomework::history{"resource.$id.solved"} !~
+  if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER') {
+    $Apache::lonhomework::results{"resource.$id.afterduedate"}=$award;
+    return '';
+  } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~
        /^correct/ ) {
     #handle assignment of tries and solved status
+    if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) {
+      $Apache::lonhomework::results{"resource.$id.afterduedate"}='';
+    }
     if ( $award eq 'APPROX_ANS' || $award eq 'EXACT_ANS' ) {
       $Apache::lonhomework::results{"resource.$id.tries"} =
 	$Apache::lonhomework::history{"resource.$id.tries"} + 1;
@@ -377,6 +383,7 @@
   my ($id) = @_;
   my $showbutton = 1;
   my $message = '';
+  my $latemessage = '';
   my $trystr='';
   my $button='';
   my $previousmsg='';
@@ -410,12 +417,16 @@
     if ( $showbutton ) { 
       $button = '<br /><input type="submit" name="submit" value="Submit Answer" />';
     }
+    if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) {
+      #last submissions was after due date
+      $latemessage="<td bgcolor=\"#ffaaaa\">The last submission was after the Due Date</td>";
+    }
   }
-  my $output= $previousmsg.$message.$trystr;
+  my $output= $previousmsg.$latemessage.$message.$trystr;
   if ($output =~ /^\s*$/) {
     return $button;
   } else {
-    return $button.'<table><tr>'.$previousmsg.$message.$trystr.'</tr></table>';
+    return $button.'<table><tr>'.$output.'</tr></table>';
   }
 }
 1;
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.82 loncom/homework/structuretags.pm:1.83
--- loncom/homework/structuretags.pm:1.82	Wed Feb 20 17:17:18 2002
+++ loncom/homework/structuretags.pm	Thu Feb 28 19:23:04 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.82 2002/02/20 22:17:18 albertel Exp $
+# $Id: structuretags.pm,v 1.83 2002/03/01 00:23:04 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -310,8 +310,7 @@
   my $result='';
   my $status=$Apache::inputtags::status['-1'];
   if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ) {
-    if ( $target eq 'grade' && $Apache::inputtags::part eq '0' &&
-       $status eq 'CAN_ANSWER') {
+    if ( $target eq 'grade' && $Apache::inputtags::part eq '0') {
       # if part is zero, no <part>s existed, so we need to the grading
       &Apache::inputtags::grade;
     } elsif ( $target eq 'web' && $Apache::inputtags::part eq '0') {