I’m trying to set up a practice assignment that allows students to do several tries, and then forces them to get a new set of values to try when they get it wrong too many times.
The reset involves two aspects: Changing the inputs to the question and resetting the answer attempts count to allow them to keep trying. Reseting the input values for the problem is easy (<callAction actionName=“resample” …) however, I can’t figure out how to reset the numAttemptsLeft value for the element.
Help would be appreciated.
We don’t currently have a way to reset the number of attempts. Instead, I’d make maxNumAttempts a number and increment that. You could, for example, set it to the current numSubmissions plus two to give two more attempts.
Here’s a working example.
<setup>
<number name="maxNumAttempts">2</number>
<sampleRandomNumbers name="n" type="discreteUniform" from="1" to="10" />
</setup>
<answer maxNumAttempts="$maxNumAttempts" name="ans">
<label>Type $n:</label>
<award>$n</award>
</answer>
<triggerSet>
<label>Reset</label>
<callAction actionName="resample" target="$n" />
<updateValue target="$maxNumAttempts" newValue="$ans.numSubmissions+2" />
</triggerSet>