From 9f8904fe53d3ad8801bb0f4a9b6eadac7cef9275 Mon Sep 17 00:00:00 2001 From: Ioanna Kokkini Date: Mon, 31 Oct 2022 20:15:06 +0000 Subject: [PATCH] Pattern match on specialReportAlt campaign id in CardStylePicker And remove unused parameter --- common/app/model/CardStylePicker.scala | 4 ++-- common/app/model/content.scala | 2 +- common/app/services/FaciaContentConvert.scala | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/app/model/CardStylePicker.scala b/common/app/model/CardStylePicker.scala index 351c2b3b9e13..138f66cbc0bd 100644 --- a/common/app/model/CardStylePicker.scala +++ b/common/app/model/CardStylePicker.scala @@ -13,7 +13,7 @@ object CardStylePicker { val tags = content.tags.map(_.id).toSeq extractCampaigns(tags) match { case Nil => CardStyle(content, TrailMetaData.empty) -// case campaign:: _ => if(campaign.id.toString == "campaign id") SpecialReportAlt else SpecialReport + case campaign:: _ => if(campaign.id.toString.toLowerCase() == "specialReportAlt") SpecialReportAlt else SpecialReport case _ => SpecialReport } } @@ -22,7 +22,7 @@ object CardStylePicker { val tags = FaciaContentUtils.tags(content).map(_.id) extractCampaigns(tags) match { case Nil => FaciaContentUtils.cardStyle(content) -// case campaign:: _ => if(campaign.id.toString == "campaign id") SpecialReportAlt else SpecialReport + case campaign:: _ => if(campaign.id.toString.toLowerCase() == "specialReportAlt") SpecialReportAlt else SpecialReport case _ => SpecialReport } } diff --git a/common/app/model/content.scala b/common/app/model/content.scala index e668ef64c90f..39a4a1f0b40a 100644 --- a/common/app/model/content.scala +++ b/common/app/model/content.scala @@ -416,7 +416,7 @@ object Content { val apifields = apiContent.fields val references: Map[String, String] = apiContent.references.map(ref => (ref.`type`, Reference.split(ref.id)._2)).toMap - val cardStyle: fapiutils.CardStyle = CardStylePicker(apiContent, TrailMetaData.empty) + val cardStyle: fapiutils.CardStyle = CardStylePicker(apiContent) Content( trail = trail, diff --git a/common/app/services/FaciaContentConvert.scala b/common/app/services/FaciaContentConvert.scala index efddeddce368..1efc78dacf5f 100644 --- a/common/app/services/FaciaContentConvert.scala +++ b/common/app/services/FaciaContentConvert.scala @@ -13,7 +13,7 @@ object FaciaContentConvert { def contentToFaciaContent(content: Content): PressedContent = { val frontendContent = model.Content(content) val trailMetaData = TrailMetaData.empty - val cardStyle = CardStylePicker(content, trailMetaData) + val cardStyle = CardStylePicker(content) val resolvedMetaData = ResolvedMetaData.fromContentAndTrailMetaData(content, trailMetaData, cardStyle) val curated = fapi.CuratedContent(