<commit_before>var HQReport = function (options) {
    'use strict';
    var self = this;
    self.domain = options.domain;
    self.datespan = options.datespan;
    self.filterSet = options.filterSet || false;
    self.needsFilters = options.needsFilters || false;
    self.filterAccordion = options.filterAccordion || "#reportFilters";
    self.filterSubmitSelector = options.filterSubmitSelector || '#paramSelectorForm button[type="submit"]';
    self.filterSubmitButton = $(self.filterSubmitSelector);
    self.toggleFiltersButton = options.toggleFiltersButton || "#toggle-report-filters";
    self.exportReportButton = options.exportReportButton || "#export-report-excel";
    self.emailReportButton = options.emailReportButton || "#email-report";
    self.printReportButton = options.printReportButton || "#print-report";
    self.emailReportModal = options.emailReportModal || "#email-report-modal";
    self.isExportable = options.isExportable || false;
    self.isExportAll = options.isExportAll || false;
    self.isEmailable = options.isEmailable || false;
    self.emailDefaultSubject = options.emailDefaultSubject || "";
    self.emailSuccessMessage = options.emailSuccessMessage;
    self.emailErrorMessage = options.emailErrorMessage;
    self.urlRoot = options.urlRoot;
    self.slug = options.slug;
    self.subReportSlug = options.subReportSlug;
    self.type = options.type;
    self.getReportRenderUrl = options.getReportRenderUrl || getReportRenderUrl;
    self.getReportBaseUrl = options.getReportBaseUrl || getReportBaseUrl;
    self.getReportParams = options.getReportParams || getReportParams;
    self.asyncExport = options.asyncExport || false;

    self.datespanCookie = self.domain+".hqreport.filterSetting.test.datespan";

    self.initialLoad = true;

    self.init = function () {
        $(function () {
            checkFilterAccordionToggleState();

            self.resetFilterState();

            if (self.needsFilters) {
                self.filterSubmitButton
                    .button('reset')
                    .addClass('btn-primary')
                    .removeClass('disabled')
                    .prop('disabled', false);
            }
            if (self.slug) {
                if (self.isExportable) {
                    var alert_user = hqImport("hqwebapp/js/alert_user").alert_user;
                    $(self.exportReportButton).click(function (e) {
                        e.preventDefault();
                        if (self.isExportAll) {
                            $.ajax({
                                url: getReportBaseUrl("export"),
                                data: getReportParams(undefined),
                                type: "POST",
                                success: function() {
                                    alert_user(gettext("Your requested excel report will be sent to the email " +
                                               "address defined in your account settings."), "success");
                                },
                            });
                        } else if (self.exportAsync) {
                                $.ajax({
                                    url: self.getReportRenderUrl("export"),
                                    success: function() {
                                        alert_user(gettext("Your requested excel report will be sent to the email " +
                                           "address defined in your account settings."), "success");
                                    },
                                });
                        } else {
                            window.location.href = self.getReportRenderUrl("export");
                        }
                    });
                }

                if (self.isEmailable) {
                    self.emailReportViewModel = new EmailReportViewModel(self);
                    $(self.emailReportModal).koApplyBindings(self.emailReportViewModel);
                }

                $(self.printReportButton).click(function (e) {
                    e.preventDefault();
                    window.open(self.getReportRenderUrl("print"));
                });
            }
        });
    };

    self.handleTabularReportCookies = function (reportDatatable) {
        var defaultRowsCookieName = self.domain+'.hqreport.tabularSetting.defaultRows',
            savedPath = window.location.pathname;<commit_msg>proper variable name<commit_after>var HQReport = function (options) {
    'use strict';
    var self = this;
    self.domain = options.domain;
    self.datespan = options.datespan;
    self.filterSet = options.filterSet || false;
    self.needsFilters = options.needsFilters || false;
    self.filterAccordion = options.filterAccordion || "#reportFilters";
    self.filterSubmitSelector = options.filterSubmitSelector || '#paramSelectorForm button[type="submit"]';
    self.filterSubmitButton = $(self.filterSubmitSelector);
    self.toggleFiltersButton = options.toggleFiltersButton || "#toggle-report-filters";
    self.exportReportButton = options.exportReportButton || "#export-report-excel";
    self.emailReportButton = options.emailReportButton || "#email-report";
    self.printReportButton = options.printReportButton || "#print-report";
    self.emailReportModal = options.emailReportModal || "#email-report-modal";
    self.isExportable = options.isExportable || false;
    self.isExportAll = options.isExportAll || false;
    self.isEmailable = options.isEmailable || false;
    self.emailDefaultSubject = options.emailDefaultSubject || "";
    self.emailSuccessMessage = options.emailSuccessMessage;
    self.emailErrorMessage = options.emailErrorMessage;
    self.urlRoot = options.urlRoot;
    self.slug = options.slug;
    self.subReportSlug = options.subReportSlug;
    self.type = options.type;
    self.getReportRenderUrl = options.getReportRenderUrl || getReportRenderUrl;
    self.getReportBaseUrl = options.getReportBaseUrl || getReportBaseUrl;
    self.getReportParams = options.getReportParams || getReportParams;
    self.asyncExport = options.asyncExport || false;

    self.datespanCookie = self.domain+".hqreport.filterSetting.test.datespan";

    self.initialLoad = true;

    self.init = function () {
        $(function () {
            checkFilterAccordionToggleState();

            self.resetFilterState();

            if (self.needsFilters) {
                self.filterSubmitButton
                    .button('reset')
                    .addClass('btn-primary')
                    .removeClass('disabled')
                    .prop('disabled', false);
            }
            if (self.slug) {
                if (self.isExportable) {
                    var alert_user = hqImport("hqwebapp/js/alert_user").alert_user;
                    $(self.exportReportButton).click(function (e) {
                        e.preventDefault();
                        if (self.isExportAll) {
                            $.ajax({
                                url: getReportBaseUrl("export"),
                                data: getReportParams(undefined),
                                type: "POST",
                                success: function() {
                                    alert_user(gettext("Your requested excel report will be sent to the email " +
                                               "address defined in your account settings."), "success");
                                },
                            });
                        } else if (self.asyncExport) {
                                $.ajax({
                                    url: self.getReportRenderUrl("export"),
                                    success: function() {
                                        alert_user(gettext("Your requested excel report will be sent to the email " +
                                           "address defined in your account settings."), "success");
                                    },
                                });
                        } else {
                            window.location.href = self.getReportRenderUrl("export");
                        }
                    });
                }

                if (self.isEmailable) {
                    self.emailReportViewModel = new EmailReportViewModel(self);
                    $(self.emailReportModal).koApplyBindings(self.emailReportViewModel);
                }

                $(self.printReportButton).click(function (e) {
                    e.preventDefault();
                    window.open(self.getReportRenderUrl("print"));
                });
            }
        });
    };

    self.handleTabularReportCookies = function (reportDatatable) {
        var defaultRowsCookieName = self.domain+'.hqreport.tabularSetting.defaultRows',
            savedPath = window.location.pathname;
{'fraction_non_alphanumeric': 0.10070969922271038, 'fraction_numerical': 0.0, 'mean_word_length': 1.6684700931770364, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2399580', 'n_tokens_mistral': 2118, 'n_tokens_neox': 2037, 'n_words': 359}