Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Refactored variable names #32

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/com/f_lab/la_planete/domain/Food.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public BigDecimal calculateCost(int quantity) {
return price.multiply(BigDecimal.valueOf(quantity));
}

public void minusQuantity(int deductions) {
if (totalQuantity - deductions < 0)
public void minusQuantity(int quantity) {
if (totalQuantity - quantity < 0)
throw new IllegalStateException("수량이 부족합니다. 따라서 구매가 진행될 수 없습니다.");

totalQuantity -= deductions;
totalQuantity -= quantity;
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/f_lab/la_planete/domain/Voucher.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public BigDecimal apply(BigDecimal totalCost, Currency currency) {
if (ObjectUtils.isEmpty(currency))
throw new IllegalStateException("화페 값이 비어있습니다. 적절히 변경 후 다시 시도해주시길 바랍니다.");

BigDecimal afterDiscounts = BigDecimal.ONE.subtract(discountRate);
return totalCost.multiply(afterDiscounts).setScale(currency.getRoundingScale(), currency.getRoundingMode());
BigDecimal multiplier = BigDecimal.ONE.subtract(discountRate);
return totalCost.multiply(multiplier).setScale(currency.getRoundingScale(), currency.getRoundingMode());
}
}
Loading