[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm

raeburn raeburn at source.lon-capa.org
Mon Apr 6 15:05:28 EDT 2015


raeburn		Mon Apr  6 19:05:28 2015 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  - Bug 6476.
    Display of rndseed in submission history will always display the "rawrndseed"
    (column header: rndseed). 
   -  Submissions stored for LON-CAPA 2.11.0 -- both "rawrndseed" and rndseed stored
    (only item with key: "rawrndseed" shown).
   - Submissions stored for LON-CAPA 2.11.1 and later -- only "rawrndseed" stored
    (key is rndseed).
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1211 loncom/interface/loncommon.pm:1.1212
--- loncom/interface/loncommon.pm:1.1211	Fri Apr  3 17:31:24 2015
+++ loncom/interface/loncommon.pm	Mon Apr  6 19:05:27 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1211 2015/04/03 17:31:24 raeburn Exp $
+# $Id: loncommon.pm,v 1.1212 2015/04/06 19:05:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4040,8 +4040,13 @@
       my %lasthash=();
       my $version;
       for ($version=1;$version<=$returnhash{'version'};$version++) {
-        foreach my $key (sort(split(/\:/,$returnhash{$version.':keys'}))) {
-	  $lasthash{$key}=$returnhash{$version.':'.$key};
+        foreach my $key (reverse(sort(split(/\:/,$returnhash{$version.':keys'})))) {
+            if ($key =~ /\.rawrndseed$/) {
+                my ($id) = ($key =~ /^(.+)\.rawrndseed$/);
+                $lasthash{$id.'.rndseed'} = $returnhash{$version.':'.$key};
+            } else {
+                $lasthash{$key}=$returnhash{$version.':'.$key};
+            }
         }
       }
       $prevattempts=&start_data_table().&start_data_table_header_row();
@@ -4161,9 +4166,15 @@
                         }
                     } else {
                         if ($key =~ /\./) {
-                            my $value = &format_previous_attempt_value($key,
-                                              $returnhash{$version.':'.$key});
-                            $prevattempts.='<td>'.$value.' </td>';
+                            my $value = $returnhash{$version.':'.$key};
+                            if ($key =~ /\.rndseed$/) {
+                                my ($id) = ($key =~ /^(.+)\.[^.]+$/);
+                                if (exists($returnhash{$version.':'.$id.'.rawrndseed'})) {
+                                    $value = $returnhash{$version.':'.$id.'.rawrndseed'};
+                                }
+                            }
+                            $prevattempts.='<td>'.&format_previous_attempt_value($key,$value).
+                                           ' </td>';
                         } else {
                             $prevattempts.='<td> </td>';
                         }
@@ -4172,9 +4183,15 @@
             } else {
 	        foreach my $key (sort(keys(%lasthash))) {
                     next if ($key =~ /\.foilorder$/);
-		    my $value = &format_previous_attempt_value($key,
-			            $returnhash{$version.':'.$key});
-		    $prevattempts.='<td>'.$value.' </td>';
+                    my $value = $returnhash{$version.':'.$key};
+                    if ($key =~ /\.rndseed$/) {
+                        my ($id) = ($key =~ /^(.+)\.[^.]+$/);
+                        if (exists($returnhash{$version.':'.$id.'.rawrndseed'})) {
+                            $value = $returnhash{$version.':'.$id.'.rawrndseed'};
+                        }
+                    }
+                    $prevattempts.='<td>'.&format_previous_attempt_value($key,$value).
+                                   ' </td>';
 	        }
             }
 	    $prevattempts.=&end_data_table_row();




More information about the LON-CAPA-cvs mailing list