Switching Between Testing and Reviewing With States

This article covers the state property, and how it is used. The state controls the startup modes of the API, to allow for different application behaviors during an assessment.

The state property will determine the mode that the API should use to initialize.
Based on its value, for a new Activity you will be able to start or preview.  For an existing Activity, you will be able to continue or review

It is not always necessary to define a state, because the API will intelligently choose a state for you based on the session ID.

If you want to specify a state for Items API, there are two possible values that you can set: "review" and "preview"

States explained

"initial" -- this state is set when an assessment is loaded without any existing session associated. This is applied automatically and is not required to be manually set at initialization. Once the assessment is commenced and a session is created, any reload of the assessment will be assigned one of the other three states either automatically or manually set in the initialization.
"preview" -- this state will display the Items in their initial (pre user interaction) or resumed state however will lock any interaction with the Item. This state can be used if there is a need to display the Items to the user, but you want to prevent them from answering the Questions.
"resume" -- this state is set when an assessment is loaded and there is an existing session associated with the assessment. This can be after a pause or a save/close event has been enacted, and the assessment then restarted or reopened. This is applied automatically and is not required to be manually set at initialization time.
"review" -- this state is used to display the item validation, showing correct and incorrect values for responses and if set, the correct answers for incorrect responses. Review state will also display distractor rationale if enabled.
Items API

When initialising Items API, the state does not need to be set. Internally, the API will check whether a session exists for a given session_id, then do one of the following:

  • If an existing session is found, then the assessment will be initialized in "resume" mode.
  • If no existing session is found, then a new assessment will be created (in "initial" mode).

However, if you want to initialise an assessment in review or preview mode, the state needs to be set using either "review" or "preview" as required.

Was this article helpful?

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