<commit_before>import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { bb } from 'billboard.js/dist/billboard.min.js';
import { action } from '@ember/object';
import { task } from 'ember-concurrency';
import dayjs from 'dayjs';
import advancedFormat from 'dayjs/plugin/advancedFormat';
import weekOfYear from 'dayjs/plugin/weekOfYear';
import weekday from 'dayjs/plugin/weekday';
import { inject as service } from '@ember/service';
import { htmlSafe } from '@ember/template';
import styles from './index.scss';

import moment from 'moment';

export default class PartnerClientUploadsStatChartComponent extends Component {
  // Dependencies
  @service store;
  @service organization;
  @service ajax;
  @service me;
  @service('notifications') notify;
  @service intl;
  @service partner;

  constructor() {
    super(...arguments);
    dayjs.extend(advancedFormat);
    dayjs.extend(weekOfYear);
    dayjs.extend(weekday);
  }

  // Properties
  datepickerOptions = [
    'last7Days',
    'last30Days',
    'thisMonth',
    'last6Months',
    'lastYear',
  ];

  @tracked isHideLegend = true;

  @tracked chartData = [];

  @tracked isRedrawChart = false;

  @tracked timelinePlaceholders = [
    {
      key: this.intl.t('day'),
      axisKey: 'date',
      format: 'DD MMM',
      tooltipFormat(d) {
        return new dayjs(d).format('DD MMM YYYY');
      },
    },
    {
      key: this.intl.t('week'),
      axisKey: 'week',
      format: 'DD MMM',
      tooltipFormat(d) {
        return `${dayjs(d).format('DD MMM YYYY')} - ${dayjs(d)
          .add(6, 'day')
          .format('DD MMM YYYY')}`;
      },
    },
    {
      key: this.intl.t('month'),
      axisKey: 'month',
      format: 'MMM YYYY',
      tooltipFormat(d) {
        return new dayjs(d).format('MMM YYYY');
      },
    },
  ];

  @tracked currentTimeline = this.timelinePlaceholders.objectAt(0);

  @tracked chartContainer = null;

  @tracked dateRange = [moment().subtract(1, 'months'), moment()];

  maxDate = dayjs(Date.now());

  get startDate() {
    return this.dateRange.objectAt(0);
  }
  get endDate() {
    return this.dateRange.objectAt(1);
  }

  get targetModel() {
    return this.args.targetModel;<commit_msg>Add in 1 month calc for numMonths in partner analystics<commit_after>import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { bb } from 'billboard.js/dist/billboard.min.js';
import { action } from '@ember/object';
import { task } from 'ember-concurrency';
import dayjs from 'dayjs';
import advancedFormat from 'dayjs/plugin/advancedFormat';
import weekOfYear from 'dayjs/plugin/weekOfYear';
import weekday from 'dayjs/plugin/weekday';
import { inject as service } from '@ember/service';
import { htmlSafe } from '@ember/template';
import styles from './index.scss';

import moment from 'moment';

export default class PartnerClientUploadsStatChartComponent extends Component {
  // Dependencies
  @service store;
  @service organization;
  @service ajax;
  @service me;
  @service('notifications') notify;
  @service intl;
  @service partner;

  constructor() {
    super(...arguments);
    dayjs.extend(advancedFormat);
    dayjs.extend(weekOfYear);
    dayjs.extend(weekday);
  }

  // Properties
  datepickerOptions = [
    'last7Days',
    'last30Days',
    'thisMonth',
    'last6Months',
    'lastYear',
  ];

  @tracked isHideLegend = true;

  @tracked chartData = [];

  @tracked isRedrawChart = false;

  @tracked timelinePlaceholders = [
    {
      key: this.intl.t('day'),
      axisKey: 'date',
      format: 'DD MMM',
      tooltipFormat(d) {
        return new dayjs(d).format('DD MMM YYYY');
      },
    },
    {
      key: this.intl.t('week'),
      axisKey: 'week',
      format: 'DD MMM',
      tooltipFormat(d) {
        return `${dayjs(d).format('DD MMM YYYY')} - ${dayjs(d)
          .add(6, 'day')
          .format('DD MMM YYYY')}`;
      },
    },
    {
      key: this.intl.t('month', {
        numMonths: 1,
      }),
      axisKey: 'month',
      format: 'MMM YYYY',
      tooltipFormat(d) {
        return new dayjs(d).format('MMM YYYY');
      },
    },
  ];

  @tracked currentTimeline = this.timelinePlaceholders.objectAt(0);

  @tracked chartContainer = null;

  @tracked dateRange = [moment().subtract(1, 'months'), moment()];

  maxDate = dayjs(Date.now());

  get startDate() {
    return this.dateRange.objectAt(0);
  }
  get endDate() {
    return this.dateRange.objectAt(1);
  }

  get targetModel() {
    return this.args.targetModel;
{'fraction_non_alphanumeric': 0.14768488040377442, 'fraction_numerical': 0.004388852315119597, 'mean_word_length': 3.121157323688969, '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': '528375', 'n_tokens_mistral': 1549, 'n_tokens_neox': 1493, 'n_words': 340}