<commit_before>function checkQuiz(e) {
    var answers = [];
    $('.radio').each(function() {
        var answered = $(this).find("input[type='radio']:checked");
        if (answered.length == 0) {
            answers.push(-1);
        }
        else {
            answers.push(answered.parent().index());
        }
    });

    //$.post('http://lidavidm-senior-project.appspot.com/submit', JSON.stringify(answers));
    //$.post('http://localhost:8080/submit', JSON.stringify(answers));

    var correct = [1,3,3,3,3,0,0,2,0,0];
    var numCorrect = 0;

    for (var i = 0; i < answers.length; i++) {
        var userAnswer = answers[i];
        var rightAnswer = correct[i];

        if (userAnswer == -1) {
            $('p.explanation').eq(i).addClass('neutral');
        }
        else if (rightAnswer == userAnswer) {
            $('p.explanation').eq(i).addClass('right');
        }
        else {
            $('p.explanation').eq(i).addClass('wrong');
        }
        if (userAnswer >= 0) {
            $('.radio').eq(i).find('li').eq(userAnswer).addClass('wrong');
        }
        $('.radio').eq(i).find('li').eq(rightAnswer).removeClass('wrong').addClass('right');
    }

    return false;
}
<commit_msg>Disable form upon submission<commit_after>function checkQuiz(e) {
    var answers = [];
    $('.radio').each(function() {
        var answered = $(this).find("input[type='radio']:checked");
        if (answered.length == 0) {
            answers.push(-1);
        }
        else {
            answers.push(answered.parent().index());
        }
    });

    //$.post('http://lidavidm-senior-project.appspot.com/submit', JSON.stringify(answers));
    //$.post('http://localhost:8080/submit', JSON.stringify(answers));

    var correct = [1,3,3,3,3,0,0,2,0,0];
    var numCorrect = 0;

    for (var i = 0; i < answers.length; i++) {
        var userAnswer = answers[i];
        var rightAnswer = correct[i];

        if (userAnswer == -1) {
            $('p.explanation').eq(i).addClass('neutral');
        }
        else if (rightAnswer == userAnswer) {
            $('p.explanation').eq(i).addClass('right');
        }
        else {
            $('p.explanation').eq(i).addClass('wrong');
        }
        if (userAnswer >= 0) {
            $('.radio').eq(i).find('li').eq(userAnswer).addClass('wrong');
        }
        $('.radio').eq(i).find('li').eq(rightAnswer).removeClass('wrong').addClass('right');
    }

    $('#submit-quiz').attr('disabled', 'true').html('Thanks for your submission!');

    return false;
}

{'fraction_non_alphanumeric': 0.21023622047244095, 'fraction_numerical': 0.015748031496062992, 'mean_word_length': 2.27027027027027, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7667555', 'n_tokens_mistral': 860, 'n_tokens_neox': 797, 'n_words': 118}