Manos Chorianopoulos

add campaigns logs

......@@ -82,7 +82,24 @@ public class swiftApi {
return isGFY && (!isCcmsOffer || (isCcmsOffer && loyaltyCampaignIdExists))
}
let matchedCampaigns = GlobalVariables.campaigns.filter {
let tempCampaign = $0
let isGFY = tempCampaign.offer_category == "gifts_for_you"
let hasExtraFields = (tempCampaign.hasExtraFields != nil) && (tempCampaign.hasExtraFields == true)
let isCcmsOffer = (tempCampaign.ccms_offer != nil) && (tempCampaign.ccms_offer != "") && (tempCampaign.ccms_offer == "true")
let loyaltyCampaignIdExists = ccmsCampaign.contains { $0._loyaltyCampaignId == tempCampaign.session_uuid }
return isGFY && isCcmsOffer && loyaltyCampaignIdExists
}
print("Got L:{" + String(GlobalVariables.campaigns.count) + "} LOYALTY campaigns")
print("Got C:{" + String(campaigns.count) + "} CCMS campaigns")
print("Matched M:{" + String(matchedCampaigns.count) + "} CCMS campaigns")
print("=====================================")
GlobalVariables.campaigns = GlobalVariables.campaigns.filter { $0.offer_category != "gifts_for_you" } + mergedGFYCampaigns
print("TOTAL: Campaigns Sum=" + String(GlobalVariables.campaigns.count) + " campaigns to display")
}
public func getCCMSLoyaltyCampaigns() -> Array<LoyaltyContextualOfferModel> {
......