<commit_before><?php

include_once '../../config.php';
include_once 'includes/header.php';

use LearnositySdk\Request\Init;
use LearnositySdk\Utils\Uuid;

$security = array(
    'consumer_key' => $consumer_key,
    'domain'       => $domain,
    'timestamp'    => $timestamp
);

$request = array(
    'user_id'        => $studentid,
    'rendering_type' => 'inline',
    'name'           => 'Items API demo - Inline Activity.',
    'state'          => 'initial',
    'activity_id'    => 'itemsinlinedemo',
    'session_id'     => Uuid::generate(),
    'course_id'      => $courseid,
    'items'          => array('act1','act2','act3','act4','act5','act6'),
    'type'           => 'submit_practice',
    'config'         => array(
        'renderSubmitButton'  => true,
        'questionsApiVersion' => 'v2'
    )
);

$Init = new Init('items', $security, $consumer_secret, $request);
$signedRequest = $Init->generate();

?>

<div class="jumbotron">
    <h1>Items API – Inline</h1>
    <p>Display items from the Learnosity Item Bank in no time with the Items API.  The Items API builds on the Questions API's power and makes it quicker to integrate.<p>
    <div class="row">
        <div class="col-md-10">
            <h4><a href="http://docs.learnosity.com/itemsapi/" class="text-muted">
                <span class="glyphicon glyphicon-book"></span> Documentation
            </a></h4>
            <h4><a href="#" class="text-muted" data-toggle="modal" data-target="#initialisation-preview">
                <span class="glyphicon glyphicon-share-alt"></span> Preview API Initialisation Object
            </a></h4>
        </div>
        <div class="col-md-2"><p class='text-right'><a class="btn btn-primary btn-lg" href="itemsapi_adaptive.php">Next <span class="glyphicon glyphicon-chevron-right"></span></a></p></div>
    </div>
</div>

<p>
    <span class="learnosity-item" data-reference="act1"></span>
    <span class="learnosity-item" data-reference="act2"></span>
    <span class="learnosity-item" data-reference="act3"></span>
    <span class="learnosity-item" data-reference="act4"></span>
    <span class="learnosity-item" data-reference="act5"></span>
    <span class="learnosity-item" data-reference="act6"></span>
    <span class="learnosity-submit-button"></span>
</p>

<!-- Container for the items api to load into -->
<script src="//items.staging.learnosity.com/"></script>
<script src="itemsapi_distractors/response-level-map.js"></script>
<script>
    var eventOptions = {
            readyListener: function () {
                //Patching functionality as awaiting a coming release of itemsInstance.questions()
                itemsInstance.questions = getQuestionResponseIds;

                $.each(itemsInstance.questions(), function(index, question) {
                    question.on("validated", function() {
                        var distractorQuestionLvl = this.getMetadata().distractor_rationale || "",
                            distractorResponseLvl = this.getMetadata().distractor_rationale_response_level || "",
                            validation = this.isValid("detailedWithPartials"),
                            question = this.getQuestion(),
                            outputHTML = "";

                        if(!validation.correct) {
                            if(distractorResponseLvl.length) {
                                var response = this.getResponse(),
                                    map = mapResponseLevel(question, response, validation),
                                    list = "";

                                $.each(distractorResponseLvl, function (index, distractor) {
                                    if (map[index] === false) { // Change here to render 'correct' distactor info or unattempted
                                        list += "<li>" + distractor + "</li>";
                                    }
                                });

                                outputHTML += list.length ? "<ul>" + list + "</ul>" : "";
                            } else if(distractorQuestionLvl.length) {
                                outputHTML += distractorQuestionLvl;
                            }

                            renderDistractor(question.response_id, outputHTML);
                        }
                    });
                });
<commit_msg>[POLISH] Pointing Distractor demo to prod again<commit_after><?php

include_once '../../config.php';
include_once 'includes/header.php';

use LearnositySdk\Request\Init;
use LearnositySdk\Utils\Uuid;

$security = array(
    'consumer_key' => $consumer_key,
    'domain'       => $domain,
    'timestamp'    => $timestamp
);

$request = array(
    'user_id'        => $studentid,
    'rendering_type' => 'inline',
    'name'           => 'Items API demo - Inline Activity.',
    'state'          => 'initial',
    'activity_id'    => 'itemsinlinedemo',
    'session_id'     => Uuid::generate(),
    'course_id'      => $courseid,
    'items'          => array('act1','act2','act3','act4','act5','act6'),
    'type'           => 'submit_practice',
    'config'         => array(
        'renderSubmitButton'  => true,
        'questionsApiVersion' => 'v2'
    )
);

$Init = new Init('items', $security, $consumer_secret, $request);
$signedRequest = $Init->generate();

?>

<div class="jumbotron">
    <h1>Items API – Inline</h1>
    <p>Display items from the Learnosity Item Bank in no time with the Items API.  The Items API builds on the Questions API's power and makes it quicker to integrate.<p>
    <div class="row">
        <div class="col-md-10">
            <h4><a href="http://docs.learnosity.com/itemsapi/" class="text-muted">
                <span class="glyphicon glyphicon-book"></span> Documentation
            </a></h4>
            <h4><a href="#" class="text-muted" data-toggle="modal" data-target="#initialisation-preview">
                <span class="glyphicon glyphicon-share-alt"></span> Preview API Initialisation Object
            </a></h4>
        </div>
        <div class="col-md-2"><p class='text-right'><a class="btn btn-primary btn-lg" href="itemsapi_adaptive.php">Next <span class="glyphicon glyphicon-chevron-right"></span></a></p></div>
    </div>
</div>

<p>
    <span class="learnosity-item" data-reference="act1"></span>
    <span class="learnosity-item" data-reference="act2"></span>
    <span class="learnosity-item" data-reference="act3"></span>
    <span class="learnosity-item" data-reference="act4"></span>
    <span class="learnosity-item" data-reference="act5"></span>
    <span class="learnosity-item" data-reference="act6"></span>
    <span class="learnosity-submit-button"></span>
</p>

<!-- Container for the items api to load into -->
<script src="//items.learnosity.com/"></script>
<script src="itemsapi_distractors/response-level-map.js"></script>
<script>
    var eventOptions = {
            readyListener: function () {
                //Patching functionality as awaiting a coming release of itemsInstance.questions()
                itemsInstance.questions = getQuestionResponseIds;

                $.each(itemsInstance.questions(), function(index, question) {
                    question.on("validated", function() {
                        var distractorQuestionLvl = this.getMetadata().distractor_rationale || "",
                            distractorResponseLvl = this.getMetadata().distractor_rationale_response_level || "",
                            validation = this.isValid("detailedWithPartials"),
                            question = this.getQuestion(),
                            outputHTML = "";

                        if(!validation.correct) { // Could show 'correct' distractors
                            if(distractorResponseLvl.length) {
                                var response = this.getResponse(),
                                    map = mapResponseLevel(question, response, validation),
                                    list = "";

                                $.each(distractorResponseLvl, function (index, distractor) {
                                    if (map[index] === false) { // Change here to render unattempted
                                        list += "<li>" + distractor + "</li>";
                                    }
                                });

                                outputHTML += list.length ? "<ul>" + list + "</ul>" : "";
                            } else if(distractorQuestionLvl.length) { // could render both level
                                outputHTML += distractorQuestionLvl;
                            }

                            renderDistractor(question.response_id, outputHTML);
                        }
                    });
                });

{'fraction_non_alphanumeric': 0.14363947518539646, 'fraction_numerical': 0.005019965772960639, 'mean_word_length': 1.9200532978014657, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 149, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5316562', 'n_tokens_mistral': 2420, 'n_tokens_neox': 2311, 'n_words': 478}