fix(LOY-39): add unwrapped surprises to benefits
This commit is contained in:
@@ -238,15 +238,18 @@ export const rewardQueryRouter = router({
|
|||||||
const nextCursor =
|
const nextCursor =
|
||||||
limit + cursor < rewardIds.length ? limit + cursor : undefined
|
limit + cursor < rewardIds.length ? limit + cursor : undefined
|
||||||
|
|
||||||
const surprisesIds = validatedApiRewards.data
|
const wrappedSurprisesIds = validatedApiRewards.data
|
||||||
.filter(
|
.filter(
|
||||||
({ type, rewardType }) =>
|
(reward) =>
|
||||||
type === "coupon" && rewardType === "Surprise"
|
reward.type === "coupon" &&
|
||||||
|
reward.rewardType === "Surprise" &&
|
||||||
|
"coupon" in reward &&
|
||||||
|
reward.coupon?.some(({ unwrapped }) => !unwrapped)
|
||||||
)
|
)
|
||||||
.map(({ rewardId }) => rewardId)
|
.map(({ rewardId }) => rewardId)
|
||||||
|
|
||||||
const rewards = cmsRewards.filter(
|
const rewards = cmsRewards.filter(
|
||||||
(reward) => !surprisesIds.includes(reward.reward_id)
|
(reward) => !wrappedSurprisesIds.includes(reward.reward_id)
|
||||||
)
|
)
|
||||||
|
|
||||||
getCurrentRewardSuccessCounter.add(1)
|
getCurrentRewardSuccessCounter.add(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user