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

raeburn raeburn at source.lon-capa.org
Mon Nov 4 08:21:25 EST 2019


raeburn		Mon Nov  4 13:21:25 2019 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  - If randomizetry parameter is included in a problem, apply that (and also
    randomizeontries, if set) when browsing a resource not in a course.
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.564 loncom/homework/structuretags.pm:1.565
--- loncom/homework/structuretags.pm:1.564	Thu Oct 31 15:01:22 2019
+++ loncom/homework/structuretags.pm	Mon Nov  4 13:21:25 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.564 2019/10/31 15:01:22 raeburn Exp $
+# $Id: structuretags.pm,v 1.565 2019/11/04 13:21:25 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -703,7 +703,7 @@
                 $env{'form.rndseed'}=$rndseed;
             }
 	}
-        if (($env{'request.state'} eq "construct") && 
+        if ((($env{'request.state'} eq "construct") || ($symb eq '')) && 
             ($Apache::lonhomework::type eq 'randomizetry')) {
             if ($numtries) {
                 if (($reqtries =~ /^\d+$/) && ($reqtries > 1)) {
@@ -1848,8 +1848,12 @@
 
 	if ($env{'request.state'} ne "construct" && 
 	    ($symb eq '' || $Apache::lonhomework::type eq 'practice')) {
+            my $rndseedval = $rndseed;
+            if (($symb eq '') && ($Apache::lonhomework::type eq 'randomizetry')) {
+                $rndseedval = $env{'form.rndseed'};
+            }
 	    $form_tag_start.='<input type="hidden" name="rndseed" value="'.
-		$rndseed.'" />'.
+		$rndseedval.'" />'.
 		    '<button type="submit" name="resetdata"
                         value="new_problem_variation">'.&mt('New Problem Variation').'</button>';
 	    if (exists($env{'form.username'})) {
@@ -1871,11 +1875,12 @@
                 $form_tag_start.=&practice_problem_header();
             }
 	    $form_tag_start.='<hr />';
-        } elsif (($env{'request.state'} ne "construct") &&
-                 ($Apache::lonhomework::type eq 'randomizetry') &&
-                 ($status eq 'CAN_ANSWER') &&
-                 ($env{'course.'.$env{'request.course.id'}.'.type'} ne 'Placement') &&
-                 (!$env{'request.role.adv'})) {
+        } 
+        if (($env{'request.state'} ne "construct") &&
+            ($Apache::lonhomework::type eq 'randomizetry') &&
+            ($status eq 'CAN_ANSWER') &&
+            ($env{'course.'.$env{'request.course.id'}.'.type'} ne 'Placement') &&
+            (!$env{'request.role.adv'})) {
 # "New Problem Variation Each Try" header suppressed for Placement Tests, unless course personnel. 
             my $reqtries = &Apache::lonnet::EXT("resource.$Apache::inputtags::part.randomizeontries");
             my $problemstatus = &get_problem_status($Apache::inputtags::part);




More information about the LON-CAPA-cvs mailing list