<commit_before>var KnowledgeTestUI = (function () {
    "use strict";

    function createTrueFalseBox(question, showAnswer) {
        var qid = question.id;
        var trueId = qid + 'true';
        var falseId = qid + 'false';

        var $trueButton = $('<input />', {
            type: 'radio',
            name: qid,
            id: trueId,
            value: '1'
        });
        var $trueLabel = $('<label></label>', {class: 'img-holder true', for: trueId, value: '1'});
        var $trueTd = $('<td></td>').append($trueButton);

        var $falseButton = $('<input />', {
            type: 'radio',
            name: qid,
            id: falseId,
            value: '0'
        });
        var $falseLabel = $('<label></label>', {class: 'img-holder false', for: falseId, value: '0'});
        var $falseTd = $('<td></td>').append($falseButton);

        if (showAnswer) {
            if (question.answer) {
                $trueButton.prop('checked', true);
            } else {
                $falseButton.prop('checked', true);
            }
            $trueButton.attr('disabled', true);
            $falseButton.attr('disabled', true);
        }

        return [$trueTd, $falseTd];
    }

    function createQuestionRow(questionNo, question, showAnswer) {
        var $questionRow = $('<tr></tr>', {id: questionNo, class: 'question'});
        var $questionData = $('<td></td>').text(text.localize(question.question));
        var $questionLink = $('<a></a>', {name: question.id});
        $questionData.append($questionLink);

        var trueFalse = createTrueFalseBox(question, showAnswer);

        return $questionRow
            .append($questionData)
            .append(trueFalse[0])
            .append(trueFalse[1]);
    }

    function createQuestionTable(questions, showAnswer) {
        var $header = $('<tr></tr>');
        var $questionColHeader = $('<th></th>', {id: 'question-header', class: 'question-col'})
            .text(text.localize('Questions'));

        var $trueColHeader = $('<th></th>', {id: 'true-header', class: 'true-col'})
            .text(text.localize('True'));

        var $falseColHeader = $('<th></th>', {id: 'fasle-header', class: 'false-col'})
            .text(text.localize('False'));

        $header
            .append($questionColHeader)
            .append($trueColHeader)
            .append($falseColHeader);

        var $tableContainer = $('<table></table>', {id: 'knowledge-test'});

        $tableContainer.append($header);
        questions.forEach(function(question, questionNo) {
            var qr = createQuestionRow(questionNo, question, showAnswer);
            $tableContainer.append(qr);
        });

        return $tableContainer;
    }

    function createResultUI(score, time) {

        var $resultTable = $('<table></table>', { class: 'kv-pairs'});
        var $scoreRow = $('<tr></tr>').append($('<td>' + text.localize('Score') + '</td>')).append($('<td>'+ score + '</td>'));

        var date = new moment();
        var submitDate = mmoment.utc(date).format('YYYY') + text.localize('Year') + moment.utc(date).format('MM') + text.localize('Month') + moment.utc(date).format('DD') + text.localize('Day') + ' (' + text.localize('Weekday') + ')';

        var $dateRow = $('<tr></tr>').append($('<td>' + text.localize('Date') + '</td>')).append($('<td>'+ submitDate + '</td>'));<commit_msg>fix typo<commit_after>var KnowledgeTestUI = (function () {
    "use strict";

    function createTrueFalseBox(question, showAnswer) {
        var qid = question.id;
        var trueId = qid + 'true';
        var falseId = qid + 'false';

        var $trueButton = $('<input />', {
            type: 'radio',
            name: qid,
            id: trueId,
            value: '1'
        });
        var $trueLabel = $('<label></label>', {class: 'img-holder true', for: trueId, value: '1'});
        var $trueTd = $('<td></td>').append($trueButton);

        var $falseButton = $('<input />', {
            type: 'radio',
            name: qid,
            id: falseId,
            value: '0'
        });
        var $falseLabel = $('<label></label>', {class: 'img-holder false', for: falseId, value: '0'});
        var $falseTd = $('<td></td>').append($falseButton);

        if (showAnswer) {
            if (question.answer) {
                $trueButton.prop('checked', true);
            } else {
                $falseButton.prop('checked', true);
            }
            $trueButton.attr('disabled', true);
            $falseButton.attr('disabled', true);
        }

        return [$trueTd, $falseTd];
    }

    function createQuestionRow(questionNo, question, showAnswer) {
        var $questionRow = $('<tr></tr>', {id: questionNo, class: 'question'});
        var $questionData = $('<td></td>').text(text.localize(question.question));
        var $questionLink = $('<a></a>', {name: question.id});
        $questionData.append($questionLink);

        var trueFalse = createTrueFalseBox(question, showAnswer);

        return $questionRow
            .append($questionData)
            .append(trueFalse[0])
            .append(trueFalse[1]);
    }

    function createQuestionTable(questions, showAnswer) {
        var $header = $('<tr></tr>');
        var $questionColHeader = $('<th></th>', {id: 'question-header', class: 'question-col'})
            .text(text.localize('Questions'));

        var $trueColHeader = $('<th></th>', {id: 'true-header', class: 'true-col'})
            .text(text.localize('True'));

        var $falseColHeader = $('<th></th>', {id: 'fasle-header', class: 'false-col'})
            .text(text.localize('False'));

        $header
            .append($questionColHeader)
            .append($trueColHeader)
            .append($falseColHeader);

        var $tableContainer = $('<table></table>', {id: 'knowledge-test'});

        $tableContainer.append($header);
        questions.forEach(function(question, questionNo) {
            var qr = createQuestionRow(questionNo, question, showAnswer);
            $tableContainer.append(qr);
        });

        return $tableContainer;
    }

    function createResultUI(score, time) {

        var $resultTable = $('<table></table>', { class: 'kv-pairs'});
        var $scoreRow = $('<tr></tr>').append($('<td>' + text.localize('Score') + '</td>')).append($('<td>'+ score + '</td>'));

        var date = new moment();
        var submitDate = moment.utc(date).format('YYYY') + text.localize('Year') + moment.utc(date).format('MM') + text.localize('Month') + moment.utc(date).format('DD') + text.localize('Day') + ' (' + text.localize('Weekday') + ')';

        var $dateRow = $('<tr></tr>').append($('<td>' + text.localize('Date') + '</td>')).append($('<td>'+ submitDate + '</td>'));
{'fraction_non_alphanumeric': 0.20035513465522345, 'fraction_numerical': 0.0017756732761171944, 'mean_word_length': 2.410191725529768, 'pattern_counts': {'":': 0, '<': 83, '<?xml version=': 0, '>': 83, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4263483', 'n_tokens_mistral': 2052, 'n_tokens_neox': 2010, 'n_words': 394}