<commit_before>/**
 * For the takeEval and preview views
 */
$(document).ready(function() {
    $("div.JSevalComment").evalComment();   //Bind comment boxes toggle link action
    var instrSel = $('div[@rel=evalinstructorSelector]');
    var assSel = $('div[@rel=evalassistantSelector]');
    instrSel.evalSelector({type:0});
    assSel.evalSelector({type:1});
    $('[id=form-branch::submitEvaluation]').bind('click', function() {
        var valid;
        if (instrSel.find('input[type=checkbox]').length !== 0) {
            var selectedInstrDomArray = instrSel.find('input:checked').get();
            if (selectedInstrDomArray.length > 0) {
                instrSel.find("div.fieldset").css({
                    background:'#fff'
                });
            } else {
                return  error("LECTURER", instrSel);
            }
        }
        if (assSel.find('input[type=checkbox]').length !== 0) {
            var selectedassistantDomArray = assSel.find('input:checked').get();
            if (selectedassistantDomArray.length > 0) {
                assSel.find("div.fieldset").css({
                    background:'#fff'
                });
			} else {
                return error("TUTOR", assSel);
            }
        }
        if (assSel.find('select').length !== 0) {
            valid = true;
            assSel.find('select').each(function() {
                if (this.selectedIndex === 0) {
                    valid = false;
                }
            });
            if (!valid) {
                return error("TUTOR", assSel);
            } else {
                assSel.find("div.fieldset").css({
                    background:'#fff'
                });
            }
        }
        if (instrSel.find('select').length !== 0) {
            valid = true;
            instrSel.find('select').each(function() {
                if (this.selectedIndex === 0) {
                    valid = false;
                }
            });
            if (!valid) {
                return  error("LECTURER", instrSel);
            } else {
                instrSel.find("div.fieldset").css({
                    background:'#fff'
                });
            }
        }
        $(this).hide();
        $('input[name=submit_process]').show();
    });

    function error(type, that) {
        alert('Please evaluate at least one ' + type + '.');
        that.find("div.fieldset").css({
            background:'#fee'
        });
        return false;
    }


});

(function($) {
    $.fn.evalSelector = function(opts) {
        var options = $.extend({}, $.fn.evalSelector.settings, opts);
        init($(this), options);
    };
    /**
     * Public variables. Once init() has ran, do not reference directly to these, use variables.options instead.
     */
    $.fn.evalSelector.settings = {<commit_msg>EVALSYS-914 merge-updates: Restore js ref to filedset tagnames as the selection control html is unchanged<commit_after>/**
 * For the takeEval and preview views
 */
$(document).ready(function() {
    $("div.JSevalComment").evalComment();   //Bind comment boxes toggle link action
    var instrSel = $('div[@rel=evalinstructorSelector]');
    var assSel = $('div[@rel=evalassistantSelector]');
    instrSel.evalSelector({type:0});
    assSel.evalSelector({type:1});
    $('[id=form-branch::submitEvaluation]').bind('click', function() {
        var valid;
        if (instrSel.find('input[type=checkbox]').length !== 0) {
            var selectedInstrDomArray = instrSel.find('input:checked').get();
            if (selectedInstrDomArray.length > 0) {
                instrSel.find("fieldset").css({
                    background:'#fff'
                });
            } else {
                return  error("LECTURER", instrSel);
            }
        }
        if (assSel.find('input[type=checkbox]').length !== 0) {
            var selectedassistantDomArray = assSel.find('input:checked').get();
            if (selectedassistantDomArray.length > 0) {
                assSel.find("fieldset").css({
                    background:'#fff'
                });
			} else {
                return error("TUTOR", assSel);
            }
        }
        if (assSel.find('select').length !== 0) {
            valid = true;
            assSel.find('select').each(function() {
                if (this.selectedIndex === 0) {
                    valid = false;
                }
            });
            if (!valid) {
                return error("TUTOR", assSel);
            } else {
                assSel.find("fieldset").css({
                    background:'#fff'
                });
            }
        }
        if (instrSel.find('select').length !== 0) {
            valid = true;
            instrSel.find('select').each(function() {
                if (this.selectedIndex === 0) {
                    valid = false;
                }
            });
            if (!valid) {
                return  error("LECTURER", instrSel);
            } else {
                instrSel.find("fieldset").css({
                    background:'#fff'
                });
            }
        }
        $(this).hide();
        $('input[name=submit_process]').show();
    });

    function error(type, that) {
        alert('Please evaluate at least one ' + type + '.');
        that.find("fieldset").css({
            background:'#fee'
        });
        return false;
    }


});

(function($) {
    $.fn.evalSelector = function(opts) {
        var options = $.extend({}, $.fn.evalSelector.settings, opts);
        init($(this), options);
    };
    /**
     * Public variables. Once init() has ran, do not reference directly to these, use variables.options instead.
     */
    $.fn.evalSelector.settings = {
{'fraction_non_alphanumeric': 0.15446304044630405, 'fraction_numerical': 0.00400976290097629, 'mean_word_length': 1.5935804701627487, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3737264', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1511, 'n_words': 286}