Manos Chorianopoulos

update setCouponList

......@@ -1748,14 +1748,15 @@ public class swiftApi {
public func setCouponList(_ coupons: Array<CouponItemModel>) {
GlobalVariables.couponList = coupons
let filteredCoupons = coupons.filter { CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: $0.discount ?? "")) }
GlobalVariables.couponList = filteredCoupons
let loyaltyBadge = LoyaltyBadgeModel()
let totalCouponDiscount = coupons.reduce(0) { $0 + (Float($1.discount ?? "") ?? 0) }
let totalCouponDiscount = filteredCoupons.reduce(0) { $0 + (Float($1.discount ?? "") ?? 0) }
loyaltyBadge._value = totalCouponDiscount
loyaltyBadge._couponCount = coupons.count
loyaltyBadge._couponCount = filteredCoupons.count
GlobalVariables.loyaltyBadge = loyaltyBadge
}
......