<commit_before>
$(document).ready(function() {
    var description = document.getElementById('description');
    var send        = document.getElementById('validate_button');

    // Only for citizen
    if (!proVersion) {
        // Switch between 2 steps
        var coordonnees = document.getElementById('coordonnees');

        var nextStep     = document.getElementById('nextStep');
        var previousStep = document.getElementById('previousStep');

        var stepDescription = document.getElementById('stepDescription');
        var stepCoordonnees = document.getElementById('stepCoordonnees');

        nextStep.addEventListener('click', function(event) {
            event.preventDefault();
            description.hidden = true;
            coordonnees.hidden = false;

            stepDescription.classList.remove('on');
            stepDescription.classList.add('off');

            stepCoordonnees.classList.remove('off');
            stepCoordonnees.classList.add('on');
        });

        previousStep.addEventListener('click', function(event) {
            event.preventDefault();
            coordonnees.hidden = true;
            description.hidden = false;

            stepCoordonnees.classList.remove('on');
            stepCoordonnees.classList.add('off');

            stepDescription.classList.remove('off');
            stepDescription.classList.add('on');
        });
    }

    // Validity step 1 : enable nexStep button if photo or comment
    var comment = document.getElementById("id_comment-text");

    function checkStep1Validity() {
        var photos = document.getElementsByClassName("thumbnail");

        if (comment.value || (photos.length > 1)) {
            nextStep.disabled = false;
            return true;
        } else {
            nextStep.disabled = true;
        }
        return false;
    }

    // Hack to detect if at least 1 photo is present
    function checkPhotoValidity() {
        setTimeout(function() {
            checkStep1Validity();
            checkPhotoValidity();
        }, 500);
    }
    checkPhotoValidity();

    comment.addEventListener('keyup', checkStep1Validity);
    comment.addEventListener('change', checkStep1Validity);

    // Check validity in refresh browser.
    checkStep1Validity();

    if (!proVersion) {
        // Validity step 2 : enable send button if all required fields are ok
        var citizenMail    = document.getElementById('id_citizen-email');
        var citizenQuality = document.getElementById('id_citizen-quality');

        function checkStep2Validity() {

            if ( (citizenMail.value) && (citizenQuality.value)) {
                send.disabled = false;
            } else {
                send.disabled = true;

                return true;
            }

            return false;
        }

        citizenMail.addEventListener('keyup', checkStep2Validity);
        citizenMail.addEventListener('change', checkStep2Validity);
        citizenQuality.addEventListener('change', checkStep2Validity);

        // Check validity in refresh browser.
        checkStep2Validity();
    }
});
<commit_msg>Dcument a report : fix validation of citizen quality<commit_after>
$(document).ready(function() {
    var description = document.getElementById('description');
    var send        = document.getElementById('validate_button');

    // Only for citizen
    if (!proVersion) {
        // Switch between 2 steps
        var coordonnees = document.getElementById('coordonnees');

        var nextStep     = document.getElementById('nextStep');
        var previousStep = document.getElementById('previousStep');

        var stepDescription = document.getElementById('stepDescription');
        var stepCoordonnees = document.getElementById('stepCoordonnees');

        nextStep.addEventListener('click', function(event) {
            event.preventDefault();
            description.hidden = true;
            coordonnees.hidden = false;

            stepDescription.classList.remove('on');
            stepDescription.classList.add('off');

            stepCoordonnees.classList.remove('off');
            stepCoordonnees.classList.add('on');
        });

        previousStep.addEventListener('click', function(event) {
            event.preventDefault();
            coordonnees.hidden = true;
            description.hidden = false;

            stepCoordonnees.classList.remove('on');
            stepCoordonnees.classList.add('off');

            stepDescription.classList.remove('off');
            stepDescription.classList.add('on');
        });
    }

    // Validity step 1 : enable nexStep button if photo or comment
    var comment = document.getElementById("id_comment-text");

    function checkStep1Validity() {
        var photos = document.getElementsByClassName("thumbnail");

        if (comment.value || (photos.length > 1)) {
            nextStep.disabled = false;
            return true;
        } else {
            nextStep.disabled = true;
        }
        return false;
    }

    // Hack to detect if at least 1 photo is present
    function checkPhotoValidity() {
        setTimeout(function() {
            checkStep1Validity();
            checkPhotoValidity();
        }, 500);
    }
    checkPhotoValidity();

    comment.addEventListener('keyup', checkStep1Validity);
    comment.addEventListener('change', checkStep1Validity);

    // Check validity in refresh browser.
    checkStep1Validity();

    if (!proVersion) {
        // Validity step 2 : enable send button if all required fields are ok
        var citizenMail    = document.getElementById('id_citizen-email');

        function checkStep2Validity() {
            var citizenQuality = $('input[name="citizen-quality"]:checked').val();

            if ( (citizenMail.value) && (citizenQuality)) {
                send.disabled = false;
            } else {
                send.disabled = true;

                return true;
            }

            return false;
        }

        citizenMail.addEventListener('keyup', checkStep2Validity);
        citizenMail.addEventListener('change', checkStep2Validity);
        $("input[name=citizen-quality]").change(checkStep2Validity);

        // Check validity in refresh browser.
        checkStep2Validity();
    }
});

{'fraction_non_alphanumeric': 0.10840496657115568, 'fraction_numerical': 0.0057306590257879654, 'mean_word_length': 2.3349256900212314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3832409', 'n_tokens_mistral': 1572, 'n_tokens_neox': 1520, 'n_words': 322}