Public Method Items API

validItems()

Checks all auto-scorable and attempted Question responses within the assessment to see if they are correct or incorrect, grouped by their Item references. Unattempted Questions are not listed in the results.

You would want to use this method so that you can show the learner a live summary of the attempted Questions and indicate which are correct or incorrect before the assessment is submitted, for example.

Note This method will not return the individual Question scores and will only return true or false values for each Question.

Examples

// Standard usage
var validationResults = itemsApp.validItems();
console.log(validationResults);

// Returns
{
    "my_item_reference_1": {
        "my_response_id_1": true,
        "my_response_id_2": false
    },
    "my_item_reference_2": {
        "my_response_id_3": false
    },

    // Unattempted
    "my_item_reference_3": {}
}

// Validating with "partial" options
var validationResultsWithPartials = itemsApp.validItems(undefined, "detailedWithPartials");
console.log(validationResultsWithPartials);

// When using the "detailedWithPartials" mode, returns:
{
    // Item result with partial scoring
    "my_item_reference_1": {
        "my_response_id_1": {
            "correct": true,
            "partial": [true]
        },
        "my_response_id_2": {
            "correct": true
        }
    },
    "my_item_reference_2": {
        "my_response_id_3": {
            "correct": false
        }
    },

    // Unattempted
    "my_item_reference_3": {}
}

Arguments

  • callback function
    Optional callback which allows for asynchronous processing of the Item results.
  • mode string

    Default: "detailed"

    Possible values:
    • "detailed"

      An object with response_ids as keys and boolean as value indicating whether the quesiton is valid or not.

      For individual Questions, shows true if the overall response is correct or false if incorrect.

    • "detailedWithPartials"

      Returns results similar to the "detailed" mode with further information for multi-part Questions. Each Question will display:

      • correct: shows true if the overall response is correct or false if incorrect
      • partial: an array showing the boolean result of each individual response in multi-part Questions.

Return value

object

Object of Item references containing Question response_ids.

For individual Questions, shows true if the overall response is correct or false if incorrect.

See code example and mode argument description.

Related articles

  • The getItemScores() method, the method used to get the scores for all auto-scorable Items in the assessment.
  • The getScores() method, the method used to get the scores for all auto-scorable Questions in the assessment.
  • The items() method, the method used to navigate between Items in the assessment.
Was this article helpful?