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

raeburn raeburn at source.lon-capa.org
Mon Apr 6 15:06:46 EDT 2015


raeburn		Mon Apr  6 19:06:46 2015 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	loncommon.pm 
  Log:
  - For 2.11
    Backport 1.1212
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1075.2.90 loncom/interface/loncommon.pm:1.1075.2.91
--- loncom/interface/loncommon.pm:1.1075.2.90	Sun Apr  5 17:47:18 2015
+++ loncom/interface/loncommon.pm	Mon Apr  6 19:06:45 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1075.2.90 2015/04/05 17:47:18 raeburn Exp $
+# $Id: loncommon.pm,v 1.1075.2.91 2015/04/06 19:06:45 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3721,8 +3721,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();
@@ -3842,9 +3847,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 =~ /^(.+)\.rndseed$/);
+                                if (exists($returnhash{$version.':'.$id.'.rawrndseed'})) {
+                                    $value = $returnhash{$version.':'.$id.'.rawrndseed'};
+                                }
+                            }
+                            $prevattempts.='<td>'.&format_previous_attempt_value($key,$value).
+                                           ' </td>';
                         } else {
                             $prevattempts.='<td> </td>';
                         }
@@ -3853,9 +3864,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 =~ /^(.+)\.rndseed$/);
+                        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