Showing
1 changed file
with
17 additions
and
0 deletions
... | @@ -81,8 +81,25 @@ public class swiftApi { | ... | @@ -81,8 +81,25 @@ public class swiftApi { |
81 | let loyaltyCampaignIdExists = ccmsCampaign.contains { $0._loyaltyCampaignId == tempCampaign.session_uuid } | 81 | let loyaltyCampaignIdExists = ccmsCampaign.contains { $0._loyaltyCampaignId == tempCampaign.session_uuid } |
82 | return isGFY && (!isCcmsOffer || (isCcmsOffer && loyaltyCampaignIdExists)) | 82 | return isGFY && (!isCcmsOffer || (isCcmsOffer && loyaltyCampaignIdExists)) |
83 | } | 83 | } |
84 | + | ||
85 | + let matchedCampaigns = GlobalVariables.campaigns.filter { | ||
86 | + let tempCampaign = $0 | ||
87 | + let isGFY = tempCampaign.offer_category == "gifts_for_you" | ||
88 | + let hasExtraFields = (tempCampaign.hasExtraFields != nil) && (tempCampaign.hasExtraFields == true) | ||
89 | + let isCcmsOffer = (tempCampaign.ccms_offer != nil) && (tempCampaign.ccms_offer != "") && (tempCampaign.ccms_offer == "true") | ||
90 | + let loyaltyCampaignIdExists = ccmsCampaign.contains { $0._loyaltyCampaignId == tempCampaign.session_uuid } | ||
91 | + return isGFY && isCcmsOffer && loyaltyCampaignIdExists | ||
92 | + } | ||
93 | + | ||
94 | + print("Got L:{" + String(GlobalVariables.campaigns.count) + "} LOYALTY campaigns") | ||
95 | + print("Got C:{" + String(campaigns.count) + "} CCMS campaigns") | ||
96 | + print("Matched M:{" + String(matchedCampaigns.count) + "} CCMS campaigns") | ||
97 | + print("=====================================") | ||
98 | + | ||
84 | 99 | ||
85 | GlobalVariables.campaigns = GlobalVariables.campaigns.filter { $0.offer_category != "gifts_for_you" } + mergedGFYCampaigns | 100 | GlobalVariables.campaigns = GlobalVariables.campaigns.filter { $0.offer_category != "gifts_for_you" } + mergedGFYCampaigns |
101 | + | ||
102 | + print("TOTAL: Campaigns Sum=" + String(GlobalVariables.campaigns.count) + " campaigns to display") | ||
86 | } | 103 | } |
87 | 104 | ||
88 | public func getCCMSLoyaltyCampaigns() -> Array<LoyaltyContextualOfferModel> { | 105 | public func getCCMSLoyaltyCampaigns() -> Array<LoyaltyContextualOfferModel> { | ... | ... |
-
Please register or login to post a comment