<commit_before>import React, { Component, } from 'react';
import {
  Button,
  Col,
  ControlLabel,
  FormControl,
  FormGroup,
  Grid,
  ListGroup,
  ListGroupItem,
  Media,
  Panel,
  Row,
} from 'react-bootstrap';
import { LinkContainer, } from 'react-router-bootstrap';

import { imagePath, } from '../util/imagePath';
import { random, } from '../util/random';
import { range, } from '../util/range';
import { resolve, } from '../util/resolve';
const data = require('../Decrypted/get_character_visual.json')
  .character_visual
  .filter(i => {
    return i.type === 'HERO'
      && !(['LIMITED', 'DESTINY', 'SUPPORT'].includes(i.rarity))
      && ['3', '4', '5', '6'].includes(i.id.match(/_\d/)[0][1]);
  });

export default class Contracts extends Component {
  state = {
    amount: 10,
    jewelsSpent: 0,
    usdSpent: 0,
    render: [],
  }

  componentWillMount = () => {}

  pickGrade = () => {
    const roll = Math.random();
console.log(roll);
    if (roll >= 0 && roll <= 0.81) {
      return '3';
    } else if (roll > 0.81 && roll <= 0.81 + 0.149) {
      return '4';
    } else if (roll > 0.81 + 0.149 && roll <= 0.81 + 0.149 + 0.035) {
      return '5';
    }
    return '6';
  }

  pickHero = (i) => {
    const forcedGrade = i % 10 ? null : '4';
    const grade = !forcedGrade ? this.pickGrade() : forcedGrade;
    let pool = !forcedGrade
      ? data
      : data.filter(i => i.isgachagolden);
    pool = pool.filter(i => i.id.match(/_\d/)[0][1] === grade);
console.log(grade);
    return pool[random(0, pool.length - 1)];
  }


  handleButton = (e) => {
    const results = range(this.state.amount)
      .map(this.pickHero)
      .map(i => {
        const name = resolve(i.name);
        const star = i.id.match(/_\d/)[0][1];
        const className = resolve(`TEXT_CLASS_${i.classid.substring(4)}`);
        const image = i.face_tex;

        return [name, star, className, image];
      });
    console.log(results);

    const jewelsSpent = this.state.amount === 10 ? 50 : 6 + (this.state.amount - 1) * 5;
    const usdSpent = jewelsSpent * 84.99 / 200;

    this.setState({
      jewelsSpent: parseInt(jewelsSpent + this.state.jewelsSpent, 10),
      usdSpent: (usdSpent + parseFloat(this.state.usdSpent)).toFixed(2),
      render: this.renderResults(results),
    });
  }

  renderResults = (results) => {<commit_msg>Remove debug comments from contracts page<commit_after>import React, { Component, } from 'react';
import {
  Button,
  Col,
  ControlLabel,
  FormControl,
  FormGroup,
  Grid,
  ListGroup,
  ListGroupItem,
  Media,
  Panel,
  Row,
} from 'react-bootstrap';
import { LinkContainer, } from 'react-router-bootstrap';

import { imagePath, } from '../util/imagePath';
import { random, } from '../util/random';
import { range, } from '../util/range';
import { resolve, } from '../util/resolve';
const data = require('../Decrypted/get_character_visual.json')
  .character_visual
  .filter(i => {
    return i.type === 'HERO'
      && !(['LIMITED', 'DESTINY', 'SUPPORT'].includes(i.rarity))
      && ['3', '4', '5', '6'].includes(i.id.match(/_\d/)[0][1]);
  });

export default class Contracts extends Component {
  state = {
    amount: 10,
    jewelsSpent: 0,
    usdSpent: 0,
    render: [],
  }

  componentWillMount = () => {}

  pickGrade = () => {
    const roll = Math.random();
    if (roll >= 0 && roll <= 0.81) {
      return '3';
    } else if (roll > 0.81 && roll <= 0.81 + 0.149) {
      return '4';
    } else if (roll > 0.81 + 0.149 && roll <= 0.81 + 0.149 + 0.035) {
      return '5';
    }
    return '6';
  }

  pickHero = (i) => {
    const forcedGrade = i % 10 ? null : '4';
    const grade = !forcedGrade ? this.pickGrade() : forcedGrade;
    let pool = !forcedGrade
      ? data
      : data.filter(i => i.isgachagolden);
    pool = pool.filter(i => i.id.match(/_\d/)[0][1] === grade);
    
    return pool[random(0, pool.length - 1)];
  }


  handleButton = (e) => {
    const results = range(this.state.amount)
      .map(this.pickHero)
      .map(i => {
        const name = resolve(i.name);
        const star = i.id.match(/_\d/)[0][1];
        const className = resolve(`TEXT_CLASS_${i.classid.substring(4)}`);
        const image = i.face_tex;

        return [name, star, className, image];
      });

    const jewelsSpent = this.state.amount === 10 ? 50 : 6 + (this.state.amount - 1) * 5;
    const usdSpent = jewelsSpent * 84.99 / 200;

    this.setState({
      jewelsSpent: parseInt(jewelsSpent + this.state.jewelsSpent, 10),
      usdSpent: (usdSpent + parseFloat(this.state.usdSpent)).toFixed(2),
      render: this.renderResults(results),
    });
  }

  renderResults = (results) => {
{'fraction_non_alphanumeric': 0.18240343347639484, 'fraction_numerical': 0.03133047210300429, 'mean_word_length': 2.6671911880409125, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 27, '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': '5769902', 'n_tokens_mistral': 1754, 'n_tokens_neox': 1633, 'n_words': 366}