Skip to content

Commit

Permalink
refactor: remove isResultCalculated logic
Browse files Browse the repository at this point in the history
  • Loading branch information
zigsong committed Feb 27, 2021
1 parent b140cd6 commit 948b71e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/js/LottoController.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default class LottoController {
reset() {
this.lottos = [];
this.purchasedPrice = 0;
this.isResultCalculated = false;

this.inputPriceView.show().resetInputPrice();
this.purchasedLottosView.hide().resetToggleSwitch();
Expand Down Expand Up @@ -73,11 +72,8 @@ export default class LottoController {
}

const lottoProcessor = new LottoProcessor(this.lottos, winningNumbers);
if (!this.isResultCalculated) {
lottoProcessor.checkMatchingNums();
lottoProcessor.calculateEarningRate(this.purchasedPrice);
this.isResultCalculated = true;
}
lottoProcessor.checkMatchingNums();
lottoProcessor.calculateEarningRate(this.purchasedPrice);

this.winningResultView.showModal(
lottoProcessor.rankCounts,
Expand Down

0 comments on commit 948b71e

Please sign in to comment.