<commit_before>import React from "react";
import PropTypes from "prop-types";
import moment from "moment";
import I18n from "i18n-js";
import DatePicker from "react-datepicker";
import {
    defaultScales,
    defaultScalesForPeriod,
    defaultScalesSpSelected,
    getDateTimeFormat,
    getPeriod
} from "../utils/time";
import SelectWrapper from "../components/select_wrapper";
import {getConnectedServiceProviders, loginAggregated, loginTimeFrame, uniqueLoginCount} from "../api";
import "react-datepicker/dist/react-datepicker.css";
import CheckBox from "../components/checkbox";
import Chart from "../components/chart";
import stopEvent from "../utils/stop";
import {isEmpty} from "../utils/utils";

const states = ["all", "prodaccepted", "testaccepted"];
const minDiffByScale = {day: 1, week: 7, month: 31, quarter: 90, year: 365};


class Stats extends React.Component {

    constructor(props, context) {
        super(props, context);
        this.allServiceProviderOption = {display: I18n.t("stats.filters.allServiceProviders"), value: "all"};
        this.state = this.getInitialStateValues();
    }

    getInitialStateValues() {
        const fullView = this.props.view === "full";
        return {
            from: fullView ? moment().subtract(1, "day") : moment().startOf("year"),
            to: moment(),
            scale: fullView ? "minute" : "day",
            loaded: false,
            data: [],
            sp: this.props.sp || this.allServiceProviderOption.value,
            allSp: [],<commit_msg>Larger timeframes when changing the scale<commit_after>import React from "react";
import PropTypes from "prop-types";
import moment from "moment";
import I18n from "i18n-js";
import DatePicker from "react-datepicker";
import {
    defaultScales,
    defaultScalesForPeriod,
    defaultScalesSpSelected,
    getDateTimeFormat,
    getPeriod
} from "../utils/time";
import SelectWrapper from "../components/select_wrapper";
import {getConnectedServiceProviders, loginAggregated, loginTimeFrame, uniqueLoginCount} from "../api";
import "react-datepicker/dist/react-datepicker.css";
import CheckBox from "../components/checkbox";
import Chart from "../components/chart";
import stopEvent from "../utils/stop";
import {isEmpty} from "../utils/utils";

const states = ["all", "prodaccepted", "testaccepted"];
const minDiffByScale = {day: 30, week: 365, month: 365, quarter: 365, year: 365 * 5};


class Stats extends React.Component {

    constructor(props, context) {
        super(props, context);
        this.allServiceProviderOption = {display: I18n.t("stats.filters.allServiceProviders"), value: "all"};
        this.state = this.getInitialStateValues();
    }

    getInitialStateValues() {
        const fullView = this.props.view === "full";
        return {
            from: fullView ? moment().subtract(1, "day") : moment().startOf("year"),
            to: moment(),
            scale: fullView ? "minute" : "day",
            loaded: false,
            data: [],
            sp: this.props.sp || this.allServiceProviderOption.value,
            allSp: [],
{'fraction_non_alphanumeric': 0.13693752023308514, 'fraction_numerical': 0.012301715765619942, 'mean_word_length': 3.452449567723343, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4730555', 'n_tokens_mistral': 891, 'n_tokens_neox': 847, 'n_words': 232}