Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2022-07-08 12:14:16 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8d7933643d160bcaa84822913bdf7604ee88555d
8d793364
1 parent
dc2e136a
refactor setCouponList
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
8d79336
...
...
@@ -2343,14 +2343,17 @@ public class swiftApi {
public
func
setCouponList
(
_
coupons
:
Array
<
CouponItemModel
>
)
{
let
filteredCoupons
=
coupons
.
filter
{
CharacterSet
.
decimalDigits
.
isSuperset
(
of
:
CharacterSet
(
charactersIn
:
$0
.
discount
??
""
))
}
GlobalVariables
.
couponList
=
filteredCoupons
let
activeCoupons
=
filteredCoupons
.
filter
({
return
$0
.
status
==
1
})
let
oldCoupons
=
filteredCoupons
.
filter
({
return
$0
.
status
==
0
})
GlobalVariables
.
couponList
=
activeCoupons
let
loyaltyBadge
=
LoyaltyBadgeModel
()
let
totalCouponDiscount
=
filtere
dCoupons
.
reduce
(
0
)
{
$0
+
(
Float
(
$1
.
discount
??
""
)
??
0
)
}
let
totalCouponDiscount
=
ol
dCoupons
.
reduce
(
0
)
{
$0
+
(
Float
(
$1
.
discount
??
""
)
??
0
)
}
loyaltyBadge
.
_value
=
totalCouponDiscount
loyaltyBadge
.
_couponCount
=
filtere
dCoupons
.
count
loyaltyBadge
.
_couponCount
=
ol
dCoupons
.
count
GlobalVariables
.
loyaltyBadge
=
loyaltyBadge
}
...
...
Please
register
or
login
to post a comment