[LON-CAPA-users] default maxtries and hinttries

Stuart Raeburn raeburn at msu.edu
Fri Jul 12 10:24:37 EDT 2013


Hi,

> I am authoring some multipart problems, and I would like to have the correct
> answer displayed as the 'hint' after maxtries, so I would like the value of
> 'hinttries' to default to the value of 'maxtries'.

Two possible approaches.

1. If you just want the "Computer's answer" to a part to be shown when  
the maximum number of tries have been used, set the "problemstatus"  
for the part to: "Yes, and show correct answer if they exceed the  
maximum number of tries."

(Set: Show Problem Status (problemstatus) for Part: 0  (i.e., for the  
problem) for this to apply to all parts).

2. If you want to provide additional explanation besides just the  
answer, once the maximum tries allowed for the part have been reached,  
include a conditional block in the problem part, and set the condition  
for the part to evaluate to true when the problem is either correct,  
no tries remain, or it is post-answer date.

Add calls to the &check_status('partid') LON-CAPA function for each  
part to the script block, and set a scalar to the value returned for  
each part, then use that scalar in the conditional block, e.g.,

<script type="loncapa/perl">
# for part: a
$status_a = &check_status('a');

# other computations

</script>

<part id="a">

<block condition="$status_a">
<startouttext />
<br />
Some explanation text about the answer $answer
<endouttext />
</block>

</part>

Notes:

1. From the documentation for &check_status():

Returns a number identifying the current status of a part. True values  
mean that a part is "done" (either unanswerable because of tries  
exhaustion, or correct) or a false value if a part can still be  
attempted. If $part is unspecified, it will check either the current <  
part > 's status or if outside of a < part > , check the status of  
previous < part > . The full set of return codes are: 'undef' means it  
is unattempted, 0 means it is attempted and wrong but still has tries,  
1 means it is marked correct, 2 means the user has exceeded the  
maximum number of tries, and 3 means it is after the answer date


2. You will need to publish this problem and import into a course to  
have access to a return value of &check_status() for "no tries left".


Stuart Raeburn
LON-CAPA Academic Consortium



> I am authoring some multipart problems, and I would like to have the correct
> answer displayed as the 'hint' after maxtries, so I would like the value of
> 'hinttries' to default to the value of 'maxtries'.
>
>
>
> 1)      In searching some of the listserv archives, it appears that I can
> use the &EXT function to retrieve the current value of maxtries, but I need
> some help with the syntax.
>
>
>
> 2)      Also, has anyone tried to do this in the problem part?
>
>
>
>     <responseparam name="hinttries" default=&EXT(whatever needed from my
> first question to get maxtries) />



More information about the LON-CAPA-users mailing list