Doug,

My previous answer to the first of your two questions concerned the situation 
where question type is set to randomizetry in a problem without parts.  Note: 
in LON-CAPA the problem as a whole is "part 0", and the "colorful" editor 
includes selection of "Parameters for a part" in an "Insert" drop-down to add a 
new parameter tag outside any part tags, i.e., for the problem as a whole 
("part 0").

If you set type to randomizetry within a problem part in Authoring Space, then 
the randomization behavior in both Authoring Space, and in course context is 
different.  In both Authoring Space and in course context you will see a green 
notification: "New Question Variation After Every N tries", which is different 
to the notification: "New Problem Variation After Every N tries" displayed in 
course context when type = randomizetry for the problem, instead of for a part.

You reported: "However, randomization does not occur, neither in the authoring 
space nor when published publicly". 

Support for question type = randomizetry was first included in LON-CAPA 2.10.0. 
In all versions of LON-CAPA released to date, when viewing a published resource 
(e.g., a URL of /res/uiuc/dmills/...) *not* included in a course, if there is a 
parameter setting of type = randomizetry within the problem it has no impact on 
the randomization in effect, as tries are used.   (Note: this applies 
regardless of whether the resource was published public or not).

It is straightforward to modify the LON-CAPA codebase so the randomization when 
viewing a published resource *not* in a course will take account of 
type=randomizetry included as a parameter in the resource itself. I have 
included that code change in the forthcoming 2.11.3 release.  See: 
mail.lon-capa.org/pipermail/lon-capa-cvs/Week-of-Mon-20191104/028815.html

As regards randomization not occurring in the Authoring Space (e.g., a URL of 
/priv/uiuc/dmills/...), that could be the result of the way randomization is 
implemented in the particular problem.  If you are using calls to &random() in 
script block(s) in a single part problem then you could see a difference 
between behavior in Authoring Space, and behavior in course context for the 
same problem.  

I have modified the LON-CAPA codebase to make the behavior consistent between 
Authoring Space and course context for single part problems, and have included 
that code change in 2.11.3.  
See: mail.lon-capa.org/pipermail/lon-capa-cvs/Week-of-Mon-20191104/028820.html

For now, if you plan to use type=randomizetry for multi-part problems which 
include script block(s) where you would typically use: &random(), you should 
instead use a LON-CAPA function which allows you to specify the seed, such as 
&random_uniform_integer.  For example, to obtain two random integers, $a and 
$b, within a script block in place of:

$a=&random(1,10,1);
$b=&random(1,10,1);

you could use:

($a,$b) = &random_uniform_integer (2,$external::randomseed,1,10);

I have also implemented changes in the LON-CAPA codebase so the standard 
LON-CAPA function: &random() will use a tries-based random seed for each part's 
script block in a multi-part problem, in the case where type = randomizetry. 
See: http://bugs.loncapa.org/show_bug.cgi?id=6919

If you want to explore type=randomizetry in operation in LON-CAPA 2.11.3 with 
the modifications implemented for bugs 6917 and 6919, visit:

testdrive.loncapa.net/adm/createaccount 

and request an instructor account.

Note: the testdrive.loncapa.net instance is a part of the LON-CAPA network (and 
hence Course Coordinators and Authors will have access to the 
cross-institutional content repository).  Account creation at 
testdrive.loncapa.net requires use of an institutional e-mail address, and also 
includes verification that the requester is faculty/staff at a post-secondary 
or K12 institution.  That is in contrast to the older testdrive.loncapa.org 
instance which is standalone, and does not require verification.

Stuart Raeburn
LON-CAPA Academic Consortium
________________________________________
From: LON-CAPA-users <lon-capa-users-boun...@mail.lon-capa.org> on behalf of 
Mills, Douglas G <dmi...@illinois.edu>
Sent: Thursday, October 31, 2019 4:55 PM
To: Discussion list for LON-CAPA users
Cc: Mills, Douglas G
Subject: Re: [LON-CAPA-users] 2 questions

HI Stuart,

I'm finding actually that IF the parameters are inserted between part tags, the 
green notification that it will randomize every N tries appears in the 
authoring space. However, randomization does not occur, neither in the 
authoring space nor when published publicly  (which of course means that it is 
randomizable anyway, maybe that has an effect on the published version? I'm 
just using the public publication as a quick test and an easy way for a 
collaborator with whom I don't have a shared course for testing to have a look. 
It's not what we'll ultimately do with these.). If I take the same problem and 
remove the part tags, the green notification does not appear in the authoring 
space and, as you describe below, it randomizes after every submission.

Doug

DOUGLAS G MILLS
Director of Instructional Technology

Department of Chemistry

University of Illinois at Urbana-Champaign
Chemistry Annex Box A2
601 S. Mathews | M/C 712
Urbana, IL 61801
217.244.5739 | fax: 217.244.8029 | dmi...@illinois.edu
chemistry.illinois.edu 
<https://urldefense.com/v3/__http://chemistry.illinois.edu__;!ioFpBMP7lJU!jWkr83RsChajVKdCBOngqTK72kBLu6mUWOzvw9ZnRApY7YWmSDxTKlO3kR0O6g$
 >

 
<https://urldefense.com/v3/__http://illinois.edu/__;!ioFpBMP7lJU!jWkr83RsChajVKdCBOngqTK72kBLu6mUWOzvw9ZnRApY7YWmSDxTKlMDT7GxXA$
 >

Under the Illinois Freedom of Information Act any written communication to or 
from university employees regarding university business is a public record and 
may be subject to public disclosure.


On 10/31/19, 12:47 PM, "LON-CAPA-users on behalf of Raeburn, Stuart" 
<lon-capa-users-boun...@mail.lon-capa.org on behalf of raeb...@msu.edu> wrote:

    Doug,

    Answer to question 1:

    Authors can include parameters within a problem to cause the randomization 
to change after N tries, by setting the questiontype parameter to randomizetry, 
and the randomizeontries to N, e.g.,

        <parameter description="Question Type" name="type" 
default="randomizetry" type="string_questiontype" />
        <parameter description="Tries before new Variation (if Qn. 
Type=randomizetry)" name="randomizeontries" default="3" type="int_pos" />

    If you use the colorful editor, and select "Parameters for a part" in an 
Insert drop-down list item, you can then insert these parameters by using the 
"Use template" drop-down list to selecting either "Question type" or "Tries 
before new Variation (if Qn. Type=randomizetry)".  In the first case, enter a 
value of: randomizetry in the Default: textbox, and in the second enter the 
desired number of tries (e.g., 3) in the Default: textbox.

    If the questiontype parameter is set to randomizetry, but randomizeontries 
is not set, then a default value of N = 1 is used.

    In course context when you include a parameter within a problem itself, 
that parameter will be listed in the "Resource Level" default column when 
displaying Content Settings for that particular resource.  (The resource level 
default can be overridden by setting a value for the same parameter in the  "in 
Course" for Resource column in table mode, i.e., further to the right).

    Currently, including a randomizeontries parameter within a problem does not 
change the behavior when viewing in Authoring Space (N=1 applies), although the 
parameter you set will be in effect when viewing in course context.  In 
addition, when the randomizetry parameter is included within a problem, the 
text: "New Problem Variation After Every N tries" is displayed in course 
context, but not when viewing in Authoring Space.

    I have filed a bug (6917) and have implemented code changes so viewing in 
Authoring Space is consistent with viewing in course context. (See 
bugs.loncapa.org/show_bug.cgi?id=6917 for details).

    Answer to question 2:

    If the problem is a cs or ci stringresponse type problem, then in a script 
block you could loop over the attempt history and retrieve the "Computer's 
answer" for a particular attempt via:

    &EXT("user.resource.$i:resource.<partID>.<responseID>.answerstring")

    (you would remove the text: "INTERNAL:" from the value returned by the 
&EXT()), and you could retrieve the submission for that particular attempt via:

    &EXT("user.resource.$i:resource..<partID>.<responseID>.submission")

    where $i is the transaction counter, as discussed in an earlier thread on 
this list (see: 
mail.lon-capa.org/pipermail/lon-capa-users/2018-October/005362.html).

    However, rendering both the instance of the question for the randomseed in 
effect, and the computer's answer for a responseitem that is not ci or cs 
stringresponse, would require implementing a change within LON-CAPA to display 
the output from rendering for these different targets with the current 
randomseed, along with an "Additional tries with new problem variation" button 
to proceed to access additional attempt(s) with the new randomseed.  I have 
filed an enhancement request for this, see: 
bugs.loncapa.org/show_bug.cgi?id=6918

    I do not know whether questiontype=randomizetry is in use by any 
instructors.  This questiontype was originally implemented to satisfy a request 
from ECE instructor(s) in the uiuc domain, but I believe ECE course(s) at uiuc 
no longer use LON-CAPA.

    Aside from the use of a questiontype set to randomizetry, you could also 
explore (a) the use of conditional blocks within a  .problem, or (b) the use of 
a .page containing multiple instances of the same resource, linked together by 
conditional links, as ways of accomplishing your goal (albeit with a potential 
side effect on points possible totals for a folder and/or course when using the 
standard gradebook).

    Stuart Raeburn
    LON-CAPA Academic Consortium
    ________________________________________
    From: LON-CAPA-users <lon-capa-users-boun...@mail.lon-capa.org> on behalf 
of Mills, Douglas G <dmi...@illinois.edu>
    Sent: Wednesday, October 30, 2019 10:31 AM
    To: Discussion list for LON-CAPA users
    Cc: Mills, Douglas G
    Subject: [LON-CAPA-users] 2 questions

    Happy Fall -- it seems to be arriving here in Champaign Urbana at least.

    I am wondering:

    (1) Is there a parameter that can be coded into a problem to refresh 
variables after x number of attempts? I know this can be done in the content 
parameters and that that is the preferred Lon-Capa approach, giving instructors 
greater autonomy over such decisions, but for specific problems in a specific 
course, the instructors are interested in after, say 3 tries, giving the 
student the answer to the current version of the problem and presenting a 
re-randomized version. Which leads to my second question:

    (2) If in the scenario above we randomize a problem after x number of 
tries, is there a way to refer to the previous randomized values so that in 
addition to the new version the student can be shown something like "The 
problem you were trying to solve was ... and the correct answer to that problem 
is ..." ? There are so many possibilities for creative implementations in 
Lon-Capa I'm pretty sure I can figure out a way of accomplishing this, but 
thought I'd go ahead and ask first since there are also so many ways of 
accessing behind-the-scenes information in Lon-Capa.

    Thanks all!

    Doug

    DOUGLAS G MILLS
    Director of Instructional Technology

    Department of Chemistry

    University of Illinois at Urbana-Champaign
    Chemistry Annex Box A2
    601 S. Mathews | M/C 712
    Urbana, IL 61801
    217.244.5739 | fax: 217.244.8029 | 
dmi...@illinois.edu<mailto:dmi...@illinois.edu>
    
chemistry.illinois.edu<https://urldefense.com/v3/__http://chemistry.illinois.edu__;!ioFpBMP7lJU!gOCbiOWHLwvFScFV1aNI_fjEUaKMpXzdwLuCxxoih9u3BrPrU6mZgHi62jSZFA$>

    
[/var/folders/kv/f3wpy1cs51521x5grm_qx4tw0000gn/T/com.microsoft.Outlook/WebArchiveCopyPasteTempFiles/P698ojxP4tc7j8gMqgPv+E4KQAAAABJRU5ErkJggg==]<https://urldefense.com/v3/__http://illinois.edu/__;!ioFpBMP7lJU!gOCbiOWHLwvFScFV1aNI_fjEUaKMpXzdwLuCxxoih9u3BrPrU6mZgHjEpsLawg$>

    Under the Illinois Freedom of Information Act any written communication to 
or from university employees regarding university business is a public record 
and may be subject to public disclosure.



_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users@mail.lon-capa.org
https://urldefense.com/v3/__http://mail.lon-capa.org/mailman/listinfo/lon-capa-users__;!ioFpBMP7lJU!jWkr83RsChajVKdCBOngqTK72kBLu6mUWOzvw9ZnRApY7YWmSDxTKlMMmZ7e2w$
_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users@mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

Reply via email to