<commit_before>import React, { Component } from 'react';

import Card from './components/Card';
import Divider from './components/Divider';
import PriceItem from './components/PriceItem';
import OrderButton from './components/OrderButton';

import './App.css';

class App extends Component {
  state = {
    orders: [],
  }

  types = [
    { type: 'cola', label: 'Cola', price: 4 },
    { type: 'fanta', label: 'Fanta', price: 4 },
    { type: 'gummibärchen', label: 'Gummibärchen', price: 3.5 },
    { type: 'knabber', label: 'Knabber', price: 1.95 },
  ]

  onAddOrder = (PriceItem) => {
    this.setState({ orders: [...this.state.orders, PriceItem] });
  }

  onRemoveLastOrder = (PriceItem) => {
    this.setState({ orders: [...this.state.orders.slice(0, -1)] });
  }

  onResetOrders = (PriceItem) => {
    this.setState({ orders: [] });
  }

  getPriceForOrderType(type) {
    return this.types.find(t => t.type === type).price;
  }

  getLabelForOrderType(type) {
    return this.types.find(t => t.type === type).label;
  }

  getTotalPrice = () => {
    const { orders } = this.state;
    return orders.reduce((sum, order) => sum + this.getPriceForOrderType(order), 0);
  }

  render() {<commit_msg>Make App class methods all assigned variables<commit_after>import React, { Component } from 'react';

import Card from './components/Card';
import Divider from './components/Divider';
import PriceItem from './components/PriceItem';
import OrderButton from './components/OrderButton';

import './App.css';

class App extends Component {
  state = {
    orders: [],
  }

  types = [
    { type: 'cola', label: 'Cola', price: 4 },
    { type: 'fanta', label: 'Fanta', price: 4 },
    { type: 'gummibärchen', label: 'Gummibärchen', price: 3.5 },
    { type: 'knabber', label: 'Knabber', price: 1.95 },
  ]

  onAddOrder = (PriceItem) => {
    this.setState({ orders: [...this.state.orders, PriceItem] });
  }

  onRemoveLastOrder = (PriceItem) => {
    this.setState({ orders: [...this.state.orders.slice(0, -1)] });
  }

  onResetOrders = (PriceItem) => {
    this.setState({ orders: [] });
  }

  getPriceForOrderType = (type) => {
    return this.types.find(t => t.type === type).price;
  }

  getLabelForOrderType = (type) => {
    return this.types.find(t => t.type === type).label;
  }

  getTotalPrice = () => {
    const { orders } = this.state;
    return orders.reduce((sum, order) => sum + this.getPriceForOrderType(order), 0);
  }

  render() {
{'fraction_non_alphanumeric': 0.18536585365853658, 'fraction_numerical': 0.008130081300813009, 'mean_word_length': 3.309982486865149, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '6902887', 'n_tokens_mistral': 849, 'n_tokens_neox': 832, 'n_words': 190}