<commit_before>$(document).ready(function() {
    $('.get-metrics-btn').click(function () {
        var id = $(this).attr('data-id')
        $(this).button('loading');
        var frm = $('#calendar-' + id);
        var frm_data = frm.serialize();
        var frm_action = frm.attr('action');
        $.ajax({
            type: frm.attr('method'),
            url: frm_action,
            data: frm_data,
            dataType: 'json',
            success: function (data) {
                if (data['metric_name'] == 'Invalid date'){
                    alert('Invalid date');
                    $('#get-metrics-' + id).button('reset');
                    return;
                }

                data['stats'] = combineMultipleMetrics(
                    data['stats'],
                    data['absolute_values'],
                    data['unit_of_measure'],
                    data['time_unit'],
                    data['average']
                );

                var chart_id;
                var legend_id;
                var legend_container_id;

                if (metrics[id] == undefined || metrics[id].last_time_unit != data['time_unit']){
                    clearGraph(id);
                    metrics[id] = {
                        date_list: [],
                        last_time_unit: data['time_unit'],
                        shared_graph: undefined,
                        metric_list: [],
                        form_id: undefined,
                        palette: new Rickshaw.Color.Palette()
                    };

                    chart_id = '#chart-' + id;
                    legend_id = '#legend-' + id;
                    legend_container_id = '#legend_container-' + id;
                }
                else {
                    $('#chart_container-' + id).append(
                        '<div id="chart-' + id + '-' + data['metric_name'] + '"></div>\
                        <div id="timeline-' + id + '-' + data['metric_name'] + '"></div>\
                        <div id="legend_container-' + id + '-' + data['metric_name'] + '">\
                            <div id="legend-' + id + '-' + data['metric_name'] + '"></div>\
                        </div>'
                    );
                    chart_id = '#chart-' + id + '-' + data['metric_name'];
                    legend_id = '#legend-' + id + '-' + data['metric_name'];
                    legend_container_id = '#legend_container-' + id + '-' + data['metric_name'];
                }
                var attribute_value = frm_data.substring(frm_data.indexOf("&") + 1);
                metrics[id].date_list.push(attribute_value);

                var returned_metrics = {
                    color: metrics[id].palette.color(),
                    stroke: 'rgba(0,0,0,0.15)',
                    data: data['stats'],
                    name: data['metric_name']
                };

                metrics[id].metric_list.push(returned_metrics);

                if (data['unit_of_measure'] == 'bytes'){
                    data['unit_of_measure'] = 'MB';
                }

                var graph = new Rickshaw.Graph({
                    element: $(chart_id)[0],
                    renderer: 'area',
                    stroke: true,
                    height: 300,<commit_msg>removed unused variable<commit_after>$(document).ready(function() {
    $('.get-metrics-btn').click(function () {
        var id = $(this).attr('data-id');
        $(this).button('loading');
        var frm = $('#calendar-' + id);
        var frm_data = frm.serialize();
        var frm_action = frm.attr('action');
        $.ajax({
            type: frm.attr('method'),
            url: frm_action,
            data: frm_data,
            dataType: 'json',
            success: function (data) {
                if (data['metric_name'] == 'Invalid date'){
                    alert('Invalid date');
                    $('#get-metrics-' + id).button('reset');
                    return;
                }

                data['stats'] = combineMultipleMetrics(
                    data['stats'],
                    data['absolute_values'],
                    data['unit_of_measure'],
                    data['time_unit'],
                    data['average']
                );

                var chart_id;
                var legend_id;
                var legend_container_id;

                if (metrics[id] == undefined || metrics[id].last_time_unit != data['time_unit']){
                    clearGraph(id);
                    metrics[id] = {
                        last_time_unit: data['time_unit'],
                        shared_graph: undefined,
                        metric_list: [],
                        form_id: undefined,
                        palette: new Rickshaw.Color.Palette()
                    };

                    chart_id = '#chart-' + id;
                    legend_id = '#legend-' + id;
                    legend_container_id = '#legend_container-' + id;
                }
                else {
                    $('#chart_container-' + id).append(
                        '<div id="chart-' + id + '-' + data['metric_name'] + '"></div>\
                        <div id="timeline-' + id + '-' + data['metric_name'] + '"></div>\
                        <div id="legend_container-' + id + '-' + data['metric_name'] + '">\
                            <div id="legend-' + id + '-' + data['metric_name'] + '"></div>\
                        </div>'
                    );
                    chart_id = '#chart-' + id + '-' + data['metric_name'];
                    legend_id = '#legend-' + id + '-' + data['metric_name'];
                    legend_container_id = '#legend_container-' + id + '-' + data['metric_name'];
                }
                var attribute_value = frm_data.substring(frm_data.indexOf("&") + 1);

                var returned_metrics = {
                    color: metrics[id].palette.color(),
                    stroke: 'rgba(0,0,0,0.15)',
                    data: data['stats'],
                    name: data['metric_name']
                };

                metrics[id].metric_list.push(returned_metrics);

                if (data['unit_of_measure'] == 'bytes'){
                    data['unit_of_measure'] = 'MB';
                }

                var graph = new Rickshaw.Graph({
                    element: $(chart_id)[0],
                    renderer: 'area',
                    stroke: true,
                    height: 300,
{'fraction_non_alphanumeric': 0.1465212716940562, 'fraction_numerical': 0.0033788972508063276, 'mean_word_length': 1.1577203445990722, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '2336661', 'n_tokens_mistral': 1768, 'n_tokens_neox': 1596, 'n_words': 289}