Skip to content

Commit f5a4eff

Browse files
committed
update: random coupon minus point method
1 parent 6cf12f4 commit f5a4eff

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/main/kotlin/gogo/gogostage/domain/coupon/root/application/CouponProcessor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class CouponProcessor(
5656
if (isGain) {
5757
participant.plusPoint(coupon.earnPoint)
5858
} else {
59-
participant.minusPoint(coupon.lostPoint!!)
59+
participant.minusPointMust(coupon.lostPoint!!)
6060
}
6161
}
6262

src/main/kotlin/gogo/gogostage/domain/stage/participant/root/persistence/StageParticipant.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ class StageParticipant(
4646
this.point -= point
4747
}
4848

49+
fun minusPointMust(point: Long) {
50+
if (this.point - point < 0) {
51+
this.point = 0
52+
return
53+
}
54+
55+
this.point -= point
56+
}
57+
4958
fun plusPoint(point: Long) {
5059
this.point += point
5160
}

0 commit comments

Comments
 (0)