cutScoreMutator - Initialization - Reports API

Reports API Initialization

cutScoreMutator()

Manipulates or mutates the score values before the following reports are rendered on the page:

You would want to use this to highlight the learners who have made the passing grade, or fallen beneath the set scores, for example.

Examples

var callbacks = {
    cutScoreMutator: function (score) {
        let performanceBand = "none";
        let voiceOverMessage = "";

        if (score.percentageItemsCorrect < 50) {
            performanceBand = "fail";
            voiceOverMessage = "Highlighted as failed";
        }

        const customDomData = {
            performance: performanceBand,
        };

        score.domData = customDomData;
        score.voiceOverMessage = voiceOverMessage;
    }
};

Arguments

  • score object

    An object containing attributes to mutate a score and assign HTML data attributes to specified elements to make them accessible for design and behavioral changes.

    • domData object

      Store custom HTML data attributes against this score's cell, for the purpose of using custom logic or CSS selectors.

      Provide a map of key-value pairs which will be stored on the DOM element as custom data attributes. Each key will be added to the score's cell as a data attribute in the form of data-custom_keyname="value". The data attribute can then be used as a CSS selector for applying custom styles, or as a DOM selector to apply your own custom logic.

      See an example of how to customize this option in the demos for last score by Item by user report and last score by Activity by user report.

    • percentageItemsCorrect numeric

      The percentage of correct Items in the score.

Return value

None (undefined).

Related articles

Was this article helpful?

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