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

raeburn raeburn at source.lon-capa.org
Fri Jun 7 16:31:51 EDT 2013


raeburn		Fri Jun  7 20:31:51 2013 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
  Log:
  - Bug 5685.
    Show timestamps in student's "Previous Tries" view unless award is
    'ASSIGNED_SCORE' (i.e., Bubblesheet grading) or submission resulted in
    not being charged a try.   
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.317 loncom/homework/inputtags.pm:1.318
--- loncom/homework/inputtags.pm:1.317	Tue Apr 30 03:03:34 2013
+++ loncom/homework/inputtags.pm	Fri Jun  7 20:31:50 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.317 2013/04/30 03:03:34 raeburn Exp $
+# $Id: inputtags.pm,v 1.318 2013/06/07 20:31:50 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1658,6 +1658,7 @@
     my $count;
     my %count_lookup;
     my $lastrndseed;
+    my $numstamps = 0;
 
     foreach my $i (1..$Apache::lonhomework::history{'version'}) {
 	my $prefix = $i.":resource.$id";
@@ -1714,10 +1715,17 @@
 	$message =~ s{(<td.*?>)}{<td>};
 	
 
-	$output.='<tr class="'.$class.'">';
-	$output.='<td align="center">'.$count.'</td>';
-	$output.=$message;
-
+	$output .= '<tr class="'.$class.'">'.
+	           '<td align="center">'.$count.'</td>'.$message;
+        if ((!$is_anon) && ($Apache::lonhomework::history{"$prefix.tries"}) &&
+            ($Apache::lonhomework::history{"$prefix.award"} ne 'ASSIGNED_SCORE') &&
+            ($Apache::lonhomework::history{$i.':timestamp'})) {
+            $output .= '<td>'.&Apache::lonlocal::locallocaltime(
+                             $Apache::lonhomework::history{$i.':timestamp'}).'</td>';
+            $numstamps ++;
+        } else {
+            $output .= '<td></td>';
+        }
 	foreach my $resid (@Apache::inputtags::response) {
 	    my $prefix = $prefix.".$resid";
 	    if (exists($Apache::lonhomework::history{"$prefix.submission"})) {
@@ -1740,10 +1748,20 @@
         $lastrndseed = $curr_rndseed;
     }
     return if ($output eq '');
-    my $headers = 
-	'<tr>'.'<th>'.&mt('Submission #').'</th><th>'.&mt('Try').
-	'</th><th colspan="'.scalar(@Apache::inputtags::response).'">'.
-	&mt('Submitted Answer').'</th>';
+    my $headers = '<tr>'.
+                  '<th>'.&mt('Submission #').'</th>'.
+                  '<th>'.&mt('Try').'</th><th>';
+    if ($numstamps) {
+        $headers .= &mt('When');
+    }
+    $headers .= '</th>';
+    my $colspan = scalar(@Apache::inputtags::response);
+    if ($colspan > 1) {
+        $headers .= '<th colspan="'.$colspan.'">';
+    } else {
+        $headers .= '<th>';
+    }
+    $headers .= &mt('Submitted Answer').'</th></tr>';
     $output ='<table class="LC_prior_tries">'.$headers.$output.'</table>';
 
     my $tries_text = &get_tries_text('link');




More information about the LON-CAPA-cvs mailing list