<commit_before>$(function () {
    // show first tab
    var tab = $('.dashboard-tabs__item:nth-child(2) > div');
    switchTab(tab.attr('data-id'), tab.attr('data-path'));


    function switchTab(id, url) {
        $('#data_overview').addClass('dashboard__content--loading');
        $('.dashboard-tabs__item').removeClass('dashboard-tabs__item--active');
        $('#tab' + id).addClass('dashboard-tabs__item--active');

        $.ajax({
            type: 'get',
            url: url,
            cache: false,
            success: function (data) {
                if (!data.overview || data.overview.sessions == 0) {
                    $('#data_no_overview').css('display', 'block');
                    $('#data_overview > .dashboard__content').css('display', 'none');
                    $('#data_overview').removeClass('dashboard__content--loading');
                } else {
                    $('#data_no_overview').css('display', 'none');
                    $('#data_overview > .dashboard__content').css('display', 'block')
                    $('#data_overview').removeClass('dashboard__content--loading');

                    $("#dashboard-chart--audience").html('');
                    // render the chart

                    var step = 100;
                    if (data.overview.chartDataMaxValue < 100) {
                        step = 10;
                    }

                    var mainChart = new Morris.Area({
                        element: 'dashboard-chart--audience',
                        lineWidth: 1,
                        lineColors: [ '#8ac9e1', '#ce77b6', '#ee9c27', '#d13f37'],
                        fillOpacity: '.9',
                        hideHover: 'auto',
                        pointSize: 0,
                        data: data.overview.chartData,
                        xkey: 'timestamp',
                        ykeys: ['pageviews', 'sessions', 'users', 'newusers'],
                        labels: ['Pageviews', 'Sessions', 'Users', 'New Sessions'],
                        behaveLikeLine: true,
                        gridTextColor: '#a7a7a7',
                        smooth: true,
                        resize: true,
                        redraw: true,
                        ymax: Math.ceil(data.overview.chartDataMaxValue / step) * step
                    });
                    setMetrics(data);
                    setGoals(data);
                }
            }
        });
    }

    // Tab switcher
    $('.dashboard-tabs__item').on('click', function () {
        var id = $(this).find('.dashboard-tabs__controller').attr('data-id');
        var url = $(this).find('.dashboard-tabs__controller').attr('data-path');
        switchTab(id, url);
    });


    $('.dashboard_update').click(function () {
        var url = $(this).attr('data-path');
        $('.dashboard_update').html('Updating...');
        $.ajax({
            type: 'get',
            url: url,
            success: function (data) {
                location.reload();
            },
            error: function () {
                location.reload();
            }
        });
    });
});
<commit_msg>changed update button behaviour<commit_after>$(function () {
    // show first tab
    var tab = $('.dashboard-tabs__item:nth-child(2) > div');
    switchTab(tab.attr('data-id'), tab.attr('data-path'));


    function switchTab(id, url) {
        $('#data_overview').addClass('dashboard__content--loading');
        $('.dashboard-tabs__item').removeClass('dashboard-tabs__item--active');
        $('#tab' + id).addClass('dashboard-tabs__item--active');

        $.ajax({
            type: 'get',
            url: url,
            cache: false,
            success: function (data) {
                if (!data.overview || data.overview.sessions == 0) {
                    $('#data_no_overview').css('display', 'block');
                    $('#data_overview > .dashboard__content').css('display', 'none');
                    $('#data_overview').removeClass('dashboard__content--loading');
                } else {
                    $('#data_no_overview').css('display', 'none');
                    $('#data_overview > .dashboard__content').css('display', 'block')
                    $('#data_overview').removeClass('dashboard__content--loading');

                    $("#dashboard-chart--audience").html('');
                    // render the chart

                    var step = 100;
                    if (data.overview.chartDataMaxValue < 100) {
                        step = 10;
                    }

                    var mainChart = new Morris.Area({
                        element: 'dashboard-chart--audience',
                        lineWidth: 1,
                        lineColors: [ '#8ac9e1', '#ce77b6', '#ee9c27', '#d13f37'],
                        fillOpacity: '.9',
                        hideHover: 'auto',
                        pointSize: 0,
                        data: data.overview.chartData,
                        xkey: 'timestamp',
                        ykeys: ['pageviews', 'sessions', 'users', 'newusers'],
                        labels: ['Pageviews', 'Sessions', 'Users', 'New Sessions'],
                        behaveLikeLine: true,
                        gridTextColor: '#a7a7a7',
                        smooth: true,
                        resize: true,
                        redraw: true,
                        ymax: Math.ceil(data.overview.chartDataMaxValue / step) * step
                    });
                    setMetrics(data);
                    setGoals(data);
                }
            }
        });
    }

    // Tab switcher
    $('.dashboard-tabs__item').on('click', function () {
        var id = $(this).find('.dashboard-tabs__controller').attr('data-id');
        var url = $(this).find('.dashboard-tabs__controller').attr('data-path');
        switchTab(id, url);
    });


    $('.dashboard_update').click(function () {
        var url = $(this).attr('data-path');
        $('.dashboard_update').html('Updating...');
        $('.dashboard_update').attr('disabled', 'disabled');
        $.ajax({
            type: 'get',
            url: url,
            success: function (data) {
                location.reload();
            },
            error: function () {
                location.reload();
            }
        });
    });
});

{'fraction_non_alphanumeric': 0.15637278013515638, 'fraction_numerical': 0.009115197234009114, 'mean_word_length': 1.3764002987303958, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '829483', 'n_tokens_mistral': 1671, 'n_tokens_neox': 1579, 'n_words': 275}