Questions API Methods
mapValidationMetadata()
Returns metadata for the Question instance mapped to responses.
This should only be used on validatable Questions that can have multiple response areas.
The metadata_key argument specifies the name of a property in the Question's metadata object. The value of this property must be an array. This method maps the values in that array to the Question responses based on their shared indexes.
The metadata being mapped should be an array within metadata.
For information about using this function to display distractor rationale, view this tutorial.
If successful, returns an object literal containing arrays that are keyed by "correct", "incorrect", and "unattempted".
Each item in these arrays is an object that contains value property that holds the response value;
an index property that refers to the shared index of both the response area and the metadata value;
and metadata property that contains the metadata value.
Returns false if the all the necessary data doesn't exist, e.g. non-existent metadata, or Question does not contain multiple response areas, etc.
Note For more information, see this tutorial article.
Arguments
-
metadata_key string
The name of the metadata property in the Question's
metadataobject to map. -
callback function
Optional. Callback that must be used for asynchronous Question types.
The following arguments are available.
-
result MappedValidationMetadata
As per return description above.
-
Return value
Type object
-
correct ValidationMetadata
-
incorrect ValidationMetadata
-
unattempted ValidationMetadata
Type definitions
-
ValidationMetadata array[object]
The following properties are supported.
-
index number
-
metadata string
-
value *
-