Skip to content

Commit 71372eb

Browse files
kangcheolungclaude
andcommitted
fix: 할인 알림 가격 비교 시 할인가 기준으로 변경
- PriceAlertService: targetPrice 계산 시 getEffectivePrice() 사용 - PriceAlertScheduler: currentPrice 비교 시 getEffectivePrice() 사용 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 32c318e commit 71372eb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/com/ongil/backend/domain/pricealert/scheduler/PriceAlertScheduler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void checkPriceAlerts() {
3737

3838
for (PriceAlert alert : alerts) {
3939
Product product = alert.getProduct();
40-
Integer currentPrice = product.getPrice();
40+
Integer currentPrice = product.getEffectivePrice();
4141
Integer targetPrice = alert.getTargetPrice();
4242

4343
if (currentPrice <= targetPrice) {

src/main/java/com/ongil/backend/domain/pricealert/service/PriceAlertService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public PriceAlert createOrUpdatePriceAlert(Long userId, PriceAlertRequest reques
4343
priceAlertRepository.findByUserIdAndProductIdAndIsActiveTrue(userId, request.getProductId())
4444
.ifPresent(PriceAlert::deactivate);
4545

46-
// 할인율로 목표 가격 계산
47-
int targetPrice = product.getPrice() * (100 - request.getDiscountRate()) / 100;
46+
// 할인율로 목표 가격 계산 (할인가 있으면 할인가 기준, 없으면 원가 기준)
47+
int targetPrice = product.getEffectivePrice() * (100 - request.getDiscountRate()) / 100;
4848

4949
// 새 건 생성
5050
PriceAlert priceAlert = PriceAlert.builder()

0 commit comments

Comments
 (0)