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

raeburn raeburn at source.lon-capa.org
Wed Mar 18 08:53:24 EDT 2015


raeburn		Wed Mar 18 12:53:24 2015 EDT

  Modified files:              
    /loncom/homework	inputtags.pm grades.pm 
  Log:
  - Bug 6476
    Whether rndseed in use is stored in submission record depends on whether 
    LON-CAPA 2.10.X or 2.11.X was hosting user's session. Check for question type 
    when deciding if 'New variation this try' should be show for a particular
    transaction,  for both user's Previous Tries pop-up and for CC's grades screen 
    (dates and submissions option).
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.332 loncom/homework/inputtags.pm:1.333
--- loncom/homework/inputtags.pm:1.332	Tue Mar 17 12:22:20 2015
+++ loncom/homework/inputtags.pm	Wed Mar 18 12:53:24 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.332 2015/03/17 12:22:20 raeburn Exp $
+# $Id: inputtags.pm,v 1.333 2015/03/18 12:53:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1739,15 +1739,15 @@
 
     my $count;
     my %count_lookup;
-    my $lastrndseed;
+    my ($lastrndseed,$lasttype);
     my $numstamps = 0;
 
     foreach my $i (1..$Apache::lonhomework::history{'version'}) {
 	my $prefix = $i.":resource.$id";
-        my $is_anon; 
+        my $is_anon;
+        my $curr_type = $Apache::lonhomework::history{"$prefix.type"};    
         if (defined($env{'form.grade_symb'})) {
-            if (($Apache::lonhomework::history{"$prefix.type"} eq 'anonsurvey') || 
-                ($Apache::lonhomework::history{"$prefix.type"} eq 'anonsurveycred')) {
+            if (($curr_type eq 'anonsurvey') || ($curr_type eq 'anonsurveycred')) {
                 $is_anon = 1;
             }
         }
@@ -1787,7 +1787,8 @@
 	    }
             my $trystr = "(".&mt('Try [_1]',$Apache::lonhomework::history{"$prefix.tries"}).")";
             if (($curr_rndseed ne '') &&  ($lastrndseed ne '')) {
-                if ($curr_rndseed ne $lastrndseed) {
+                if (($curr_rndseed ne $lastrndseed) && 
+                    (($curr_type eq 'randomizetry') || ($lasttype eq 'randomizetry'))) {
                     $trystr .= '<br /><span style="color: green; white-space: nowrap; font-style: italic; font-weight: bold; font-size: 80%;">'.&mt('New problem variation this try.').'</span>';
                 }
             } 
@@ -1828,6 +1829,7 @@
 	}
 	$output.=&Apache::loncommon::end_data_table_row()."\n";
         $lastrndseed = $curr_rndseed;
+        $lasttype = $curr_type;
     }
     return if ($output eq '');
     my $headers = '<tr>'.
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.734 loncom/homework/grades.pm:1.735
--- loncom/homework/grades.pm:1.734	Tue Mar 17 12:22:20 2015
+++ loncom/homework/grades.pm	Wed Mar 18 12:53:24 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.734 2015/03/17 12:22:20 raeburn Exp $
+# $Id: grades.pm,v 1.735 2015/03/18 12:53:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4806,7 +4806,7 @@
 
     my $interaction;
     my $no_increment = 1;
-    my %lastrndseed;
+    my (%lastrndseed,%lasttype);
     for ($version=1;$version<=$$record{'version'};$version++) {
 	my $timestamp = 
 	    &Apache::lonlocal::locallocaltime($$record{$version.':timestamp'});
@@ -4865,11 +4865,13 @@
 			    $displaySub[0].=&mt('Trial: [_1]',
 					    $$record{"$where.$partid.tries"});
                             if (($rndseed ne '') && ($lastrndseed{$partid} ne '')) {
-                                if ($rndseed ne $lastrndseed{$partid}) {
+                                if (($rndseed ne $lastrndseed{$partid}) &&
+                                    (($type eq 'randomizetry') || ($lasttype{$partid} eq 'randomizetry'))) {
                                     $newvariation = ' ('.&mt('New variation this try').')';
                                 }
                             }
                             $lastrndseed{$partid} = $rndseed;
+                            $lasttype{$partid} = $type;
 		        }
 		        my $responseType=($isTask ? 'Task'
                                               : $responseType->{$partid}->{$responseId});




More information about the LON-CAPA-cvs mailing list