Skip to content

Add variant / seed to problem_check events #369

@bmtcril

Description

@bmtcril

See #365 for more details, but the issue is that advanced problems can be randomized as documented here. Those seeds can cause there to be different correct answers for the same problem, making it difficult to understand which values are "correct". We may want to add the variant / seed of the problem to the transforms.

Here is a sample problem to test with:

<problem>

<script type="loncapa/python">

def test_add(expect, ans):
    try:
        a1=int(ans[0])
        a2=int(ans[1])
        return (a1+a2) == int(expect)
    except ValueError:
        return False

target_sum = random.randint(0, 100)
</script>

<p>Enter two integers that sum to $target_sum: </p>
<customresponse cfn="test_add" expect="$target_sum">
  <textline size="40" label="Integer #1"/><br/>
  <textline size="40" label="Integer #2"/>
</customresponse>

</problem>

To use this, in Studio: Add Problem -> Advanced tab -> Blank Advanced Problem. Paste the above. Then you can set the randomization value in the settings to "Always". You should be able to reset the problem and get a different value each time. This does get passed in the tracking event as "variant", but I wasn't able to find an xAPI concept for this information so we'd probably have to create one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions