<commit_before>import React from 'react';
import MiqFormRenderer, { useFormApi } from '@@ddf';
import PropTypes from 'prop-types';
import { FormSpy } from '@data-driven-forms/react-form-renderer';
import createSchema from './service-request-default.schema';

// NOTE: parameters to be used as filters
let daysAgo;
let types;

// NOTE: processing the user selected filter values
const onSubmitData = (values, miqRequestInitialOptions) => {
  // Type (with_request_type)
  if (values.types && values.types !== 'all') {
    types = [values.types];
  } else { // default to all
    types = miqRequestInitialOptions.requestType;
  }

  // Request Date (created_recently)
  if (values.selectedPeriod) { // user selected
    daysAgo = values.selectedPeriod;
  } else { // default
    daysAgo = miqRequestInitialOptions.timePeriods[0].value;
  }

  const submitThis = [
    [
      'created_recently',
      parseInt(daysAgo, 10),
    ], [
      'with_approval_state',
      values.approvalStateCheckboxes,
    ], [
      'with_request_type',
      types,
    ],
  ];

  if (values.reasonText) {
    submitThis.push([
      'with_reason_like',
      values.reasonText,
    ]);
  }

  sendDataWithRx({ type: 'setScope', namedScope: submitThis });
};

const ServiceRequestDefault = ({ miqRequestInitialOptions }) => {<commit_msg>code to fix apply button<commit_after>import React from 'react';
import MiqFormRenderer, { useFormApi } from '@@ddf';
import PropTypes from 'prop-types';
import { FormSpy } from '@data-driven-forms/react-form-renderer';
import createSchema from './service-request-default.schema';

// NOTE: parameters to be used as filters
let daysAgo;

// NOTE: processing the user selected filter values
const onSubmitData = (values, miqRequestInitialOptions) => {
  // Request Date (created_recently)
  if (values.selectedPeriod) { // user selected
    daysAgo = values.selectedPeriod;
  } else { // default
    daysAgo = miqRequestInitialOptions.timePeriods[0].value;
  }

  const submitThis = [
    [
      'created_recently',
      parseInt(daysAgo, 10),
    ], [
      'with_approval_state',
      values.approvalStateCheckboxes,
    ], [
      'with_type',
      miqRequestInitialOptions.requestType,
    ],
  ];

  if (values.types && values.types !== 'all') {
    submitThis.push([
      'with_request_type',
      [values.types],
    ]);
  }

  if (values.reasonText) {
    submitThis.push([
      'with_reason_like',
      values.reasonText,
    ]);
  }

  sendDataWithRx({ type: 'setScope', namedScope: submitThis });
};

const ServiceRequestDefault = ({ miqRequestInitialOptions }) => {
{'fraction_non_alphanumeric': 0.12946600076834422, 'fraction_numerical': 0.002305032654629274, 'mean_word_length': 3.4285714285714284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6718142', 'n_tokens_mistral': 810, 'n_tokens_neox': 799, 'n_words': 179}