<commit_before>import React, { PropTypes } from 'react'

function start_stock_take (seconds, decrementStock) {
  setTimeout(() => {
    decrementStock()
    if (this.props.amount > 0) {
      start_stock_take(seconds, decrementStock)
    }
  }, seconds)
}

class Business extends React.Component {
  componentDidMount () {
    start_stock_take(5000, this.props.decrementStock).bind(this)
  }
  render () {
    return (
    <div className='col-xs-4'>
      <div className='panel panel-default'>
        <div className='panel-heading'>
          <h3 className='panel-title'>{this.props.name}</h3>
        </div>
        <div className='panel-body'>
          <p>Stock Remaining: {this.props.amount}</p>
          <p>
            <button className='btn btn-default'
                    onClick={this.props.incrementStock}>
              Buy Stock
            </button>
          </p>
        </div>
      </div>
    </div>
    )
  }
  static propTypes = {
    name: PropTypes.string.isRequired,
    amount: PropTypes.number.isRequired,
    incrementStock: PropTypes.func.isRequired,
    decrementStock: PropTypes.func.isRequired
  };
}
export default Business
<commit_msg>stock is now used periodically<commit_after>import React, { PropTypes } from 'react'

class Business extends React.Component {
  start_stock_take (seconds, decrementStock) {
    setTimeout(() => {
      if (this.props.amount > 0) {
        decrementStock()
      }
      this.start_stock_take(seconds, decrementStock)
    }, seconds)
  }
  componentDidMount () {
    this.start_stock_take(5000, this.props.decrementStock)
  }
  render () {
    return (
    <div className='col-xs-4'>
      <div className='panel panel-default'>
        <div className='panel-heading'>
          <h3 className='panel-title'>{this.props.name}</h3>
        </div>
        <div className='panel-body'>
          <p>Stock Remaining: {this.props.amount}</p>
          <p>
            <button className='btn btn-default'
                    onClick={this.props.incrementStock}>
              Buy Stock
            </button>
          </p>
        </div>
      </div>
    </div>
    )
  }
  static propTypes = {
    name: PropTypes.string.isRequired,
    amount: PropTypes.number.isRequired,
    incrementStock: PropTypes.func.isRequired,
    decrementStock: PropTypes.func.isRequired
  };
}
export default Business

{'fraction_non_alphanumeric': 0.1292372881355932, 'fraction_numerical': 0.006779661016949152, 'mean_word_length': 2.3922413793103448, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 39, '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': '5870304', 'n_tokens_mistral': 724, 'n_tokens_neox': 712, 'n_words': 135}