Skip to content

Commit

Permalink
coupon reset
Browse files Browse the repository at this point in the history
  • Loading branch information
rajranjan0608 committed Nov 27, 2023
1 parent 0f36ed8 commit bf72d68
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CouponService/couponService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Coupon = {
consumedAmount: number,
expiry: number,
amountPerCoupon: number,

reset: boolean,
}

type CouponConfig = {
Expand Down Expand Up @@ -82,7 +82,8 @@ export class CouponService {
dbItemSet.add(coupon.id)

// Only load new coupons into memory
if (this.coupons.get(coupon.id) === undefined) {
if (this.coupons.get(coupon.id) === undefined || coupon.reset) {
coupon.reset = false
this.coupons.set(coupon.id, coupon)
}
} else {
Expand Down

0 comments on commit bf72d68

Please sign in to comment.