<commit_before>
function addRatingChangeHandler(results_table) {
    $( "form#feedbackForm label.btn" ).click(function() {
        var rowData = results_table.rows('.selected').data()[0];

        var rating;
        if (this.id == 'labelGood') {
            rating = 1;
        }
        else if (this.id == 'labelBad') {
            rating = -1;
        }
        else {
            rating = 0;
        }

        $.ajax({
            url: '/feedback-rating',
            type: 'POST',
            contentType: 'application/x-www-form-urlencoded',
            data: {
                'job_id': rowData[12],
                'db_id': rowData[15],
                'sf_id': rowData[13],
                'adduct': rowData[5],
                'fdr_thr': $("#fdr_thr_btn").text(),
                'rating': rating
            }
        }).done(function() {
            console.log('Sent rating to the backend: ' + rating);
        }).error(function(error) {
            console.log(error);
        });
    });
}

function addCommentSaveHandler(results_table) {
    $("#feedbackForm").submit(function (e) {
        var rowData = results_table.rows('.selected').data()[0];
        var comment = $("textarea[name=comment]").val();

        $.ajax({
            url: '/feedback-comment',
            type: 'POST',
            contentType: 'application/x-www-form-urlencoded',
            data: {
                'job_id': rowData[12],
                'db_id': rowData[15],
                'sf_id': rowData[13],
                'adduct': rowData[5],
                'fdr_thr': $("#fdr_thr_btn").text(),
                'comment': comment
            }
        }).done(function() {<commit_msg>bug fix: feedback.js -  wrong job_id column number used<commit_after>
function addRatingChangeHandler(results_table) {
    $( "form#feedbackForm label.btn" ).click(function() {
        var rowData = results_table.rows('.selected').data()[0];

        var rating;
        if (this.id == 'labelGood') {
            rating = 1;
        }
        else if (this.id == 'labelBad') {
            rating = -1;
        }
        else {
            rating = 0;
        }

        $.ajax({
            url: '/feedback-rating',
            type: 'POST',
            contentType: 'application/x-www-form-urlencoded',
            data: {
                'job_id': rowData[11],
                'db_id': rowData[15],
                'sf_id': rowData[13],
                'adduct': rowData[5],
                'fdr_thr': $("#fdr_thr_btn").text(),
                'rating': rating
            }
        }).done(function() {
            console.log('Sent rating to the backend: ' + rating);
        }).error(function(error) {
            console.log(error);
        });
    });
}

function addCommentSaveHandler(results_table) {
    $("#feedbackForm").submit(function (e) {
        var rowData = results_table.rows('.selected').data()[0];
        var comment = $("textarea[name=comment]").val();

        $.ajax({
            url: '/feedback-comment',
            type: 'POST',
            contentType: 'application/x-www-form-urlencoded',
            data: {
                'job_id': rowData[11],
                'db_id': rowData[15],
                'sf_id': rowData[13],
                'adduct': rowData[5],
                'fdr_thr': $("#fdr_thr_btn").text(),
                'comment': comment
            }
        }).done(function() {
{'fraction_non_alphanumeric': 0.15883734586024661, 'fraction_numerical': 0.011156782149148562, 'mean_word_length': 1.5387481371087928, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '5502448', 'n_tokens_mistral': 1025, 'n_tokens_neox': 968, 'n_words': 177}