Manos Chorianopoulos

update setCouponList

...@@ -1748,14 +1748,15 @@ public class swiftApi { ...@@ -1748,14 +1748,15 @@ public class swiftApi {
1748 1748
1749 1749
1750 public func setCouponList(_ coupons: Array<CouponItemModel>) { 1750 public func setCouponList(_ coupons: Array<CouponItemModel>) {
1751 - GlobalVariables.couponList = coupons 1751 + let filteredCoupons = coupons.filter { CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: $0.discount ?? "")) }
1752 + GlobalVariables.couponList = filteredCoupons
1752 1753
1753 let loyaltyBadge = LoyaltyBadgeModel() 1754 let loyaltyBadge = LoyaltyBadgeModel()
1754 1755
1755 - let totalCouponDiscount = coupons.reduce(0) { $0 + (Float($1.discount ?? "") ?? 0) } 1756 + let totalCouponDiscount = filteredCoupons.reduce(0) { $0 + (Float($1.discount ?? "") ?? 0) }
1756 1757
1757 loyaltyBadge._value = totalCouponDiscount 1758 loyaltyBadge._value = totalCouponDiscount
1758 - loyaltyBadge._couponCount = coupons.count 1759 + loyaltyBadge._couponCount = filteredCoupons.count
1759 1760
1760 GlobalVariables.loyaltyBadge = loyaltyBadge 1761 GlobalVariables.loyaltyBadge = loyaltyBadge
1761 } 1762 }
......