Skip to content

Commit

Permalink
refactor: getStatistics -> getComputedResult 이름 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
365kim committed Apr 18, 2021
1 parent 1ee3b01 commit 911aaf7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/components/containers/UserResult/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Component } from 'react';
import ResultTable from './ResultTable';
import ResultSummary from './ResultSummary';
import { Animation, PlainButton, XButton } from '../../shared';
import { getMatchCount, getStatistics } from './service';
import { getComputedResult } from './service';
import { coin } from '../../../statics';
import './style.css';

Expand All @@ -25,8 +25,7 @@ export default class UserResultContainer extends Component {

componentDidMount() {
const { lottoBundle, winningNumber } = this.props;
const matchCount = getMatchCount(lottoBundle, winningNumber);
const result = getStatistics(lottoBundle, matchCount);
const result = getComputedResult(lottoBundle, winningNumber);

this.setState({ result });
setTimeout(this.destroyAnimation, COIN_ANIMATION_DURATION);
Expand Down
3 changes: 2 additions & 1 deletion src/components/containers/UserResult/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export const getMatchCount = (lottoBundle, winningNumber) => {
}, {});
};

export const getStatistics = (lottoBundle, matchCount) => {
export const getComputedResult = (lottoBundle, winningNumber) => {
const matchCount = getMatchCount(lottoBundle, winningNumber);
const investment = lottoBundle.length * LOTTO_UNIT_PRICE;
const profit = Object.keys(matchCount).reduce(
(acc, key) => acc + matchCount[key] * RESULT_TABLE_DATA[key].PRIZE,
Expand Down

0 comments on commit 911aaf7

Please sign in to comment.