getPractice - Methods - Rubric Editor API

Rubric Editor API Methods

getPractice()

Returns the current state of the Test panel, including the stimulus, sources, responses, and session state.

You would want to use this method to read back the current Test panel content and scoring results. This could be useful, for example, if you wanted to persist the state in your own application after a test run has completed.

Note This method returns normalized data, not your raw input to setPractice() (or the rubric_practice initialization option). The practice data is sanitized when it is set, so the returned value may differ from what you originally supplied.

Examples

const practice = await editor.getPractice();
console.log(practice);

/* Example output:
{
    stimulus: '<p>Write a short response about the water cycle.</p>',
    sources: [
        { title: 'Reference material', content: '<p>The water cycle...</p>' }
    ],
    sessionState: {
        isConfigured: true,
        isAvailable: true,
        isExhausted: false
    },
    responses: [
        {
            content: '<p>Water evaporates from the surface...</p>',
            scoring: {
                autoScores: [...],
                manualComparison: [...],
                creditsUsed: 1
            }
        }
    ]
}
*/

Arguments

None.

Return value

Type Promise

Resolves to an object with the following properties:

  • stimulus string

    The current stimulus content set in the Test panel.

  • sources array[object]

    The current list of sources set in the Test panel.

    The following properties are supported.

    • title string

      The title of the source.

    • content string

      The HTML content of the source.

  • sessionState object

    The current state of the rubric practice session.

    The following properties are supported.

    • isConfigured boolean

      Indicates whether rubric practice has been configured for this editor instance.

    • isAvailable boolean

      Indicates whether practice can run right now.

      This will be false when required configuration is missing (such as security_provider or stimulus), when the access token limit has been exhausted, or when a runtime error has occurred.

    • isExhausted boolean

      Indicates whether the rubric practice access token limit has been exhausted.

    • errorMessage string

      A human-readable message describing why practice is currently unavailable.

      Present only when isAvailable is false.

  • responses array[object]

    The current list of responses in the Test panel.

    The following properties are supported.

    • content string

      The HTML content of the response.

    • scoring object

      The scoring results for this response.

      The following properties are supported.

      • autoScores array[object]

        The generated scores from the last test run for this response.

      • manualComparison array[object]

        The expected scores set manually by the author using the comparison rubric in the Test panel.

      • creditsUsed number

        The number of credits consumed by the last test run for this response.

      • error object

        Present when the last test run for this response produced an error.

        The following properties are supported.

        • message string

          A description of the error.

        • code string

          The error code.

Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.