Skip to content

Commit

Permalink
fix: reduce user points upon valid redeem
Browse files Browse the repository at this point in the history
  • Loading branch information
RukshanJS committed Jan 18, 2024
1 parent 906a26e commit 2c21833
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/modules/points/points.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ export class PointsService {
} else if (transactionType === PointTransactionTypes.DEDUCT) {
// For DEDUCT type, adjust the 'reduceBy' value to not go below zero.
updatedPoints = Math.max(currentPoints - Math.abs(reduceBy), 0);
} else if (transactionType === PointTransactionTypes.REDEEM) {
updatedPoints = currentPoints - Math.abs(reduceBy);
}

try {
Expand Down

0 comments on commit 2c21833

Please sign in to comment.