PrairieLearn icon indicating copy to clipboard operation
PrairieLearn copied to clipboard

Add disorder-feedback attribute to pl-order-blocks

Open wendyguo2002 opened this issue 7 months ago • 3 comments

Description

This pull request introduces a new disorder feedback feature for the DAG grading method. This enhancement enables custom feedback messages when blocks are ordered incorrectly based on specific conditions. The update also includes error handling for feedback messages within the DAG grading framework.

Key Features

Definitions

  • Target-Tag: A target-tag is the tag of the block that is evaluated against the condition-tag to determine if it’s in the correct order. The disorder feedback is associated with this tag if the condition is not met.

  • Condition-Tag: A condition-tag is an attribute that specifies a reference tag in the sequence. It indicates the tag that the current block should be compared against in terms of order. For example, condition-tag="2" points to a block with tag 2.

  • Condition: The condition attribute defines the relative position of the current block concerning the condition-tag. It can be set to either after or before, dictating whether the target block should appear after or before the specified condition-tag.

Example of Disorder Feedback

Below is a simple discrete math example demonstrating the disorder feedback feature. The feedback will be displayed if the students don't place block with tag 1 or tag 2 before block with tag 4.

<pl-order-blocks answers-name="test-1" source-blocks-order="random" grading-method="dag" partial-credit="lcs" solution-placement="bottom">
    <pl-answer correct="true" tag="1" depends="">Let $k, n_1, n_2$ be arbitrary positive integers.</pl-answer>
    <pl-answer correct="true" tag="2" depends="1">Assume that $k|n_1$ and $k|n_2.$</pl-answer>
    <pl-answer correct="true" tag="3" depends="2">By definition, we know $q_1,q_2$ exist such that $n_1 = k\cdot q_1$ and $n_2=k\cdot q_2.$</pl-answer>
    <pl-answer correct="true" tag="4" depends="3">From here, $n_1+n_2=k\cdot q_1 + k\cdot q_2=k\cdot(q_1+q_2).$</pl-answer>
    <pl-answer correct="true" tag="5" depends="4">Now, by definition $k|(n_1+n_2).$</pl-answer>
    <pl-feedback>
        <pl-feedback-message condition-tag="1" condition="after" target-tag="4">Make sure you define k, n1, and n2 first</pl-feedback-message>
        <pl-feedback-message condition-tag="2" condition="after" target-tag="4">Other feedback</pl-feedback-message>
    </pl-feedback>
</pl-order-blocks>
Screenshot 2024-08-23 at 1 55 46 PM Screenshot 2024-08-23 at 1 56 06 PM Screenshot 2024-08-23 at 1 56 23 PM

Error Handling and Validation

  • Condition-Tag Self-Reference: An exception is raised if a condition-tag and target-tag are the same.

  • Invalid Grading Method: An exception is raised if disorder feedback is used outside the DAG grading method.

  • Invalid Feedback Tag: An exception is raised if any HTML tag other than <pl-feedback-message> is nested inside <pl-feedback>.

  • Missing Attributes: An exception is raised if any required attribute (condition-tag, condition, target-tag) is missing in <pl-feedback-message>.

  • Invalid Condition Value: An exception is raised if the condition attribute is not set to either "after" or "before".

wendyguo2002 avatar Jul 19 '24 03:07 wendyguo2002