Skip to content

Commit

Permalink
Add guard in case of list with one element in CardStylePicker
Browse files Browse the repository at this point in the history
  • Loading branch information
ioannakok committed Nov 18, 2022
1 parent 67a4c99 commit 6d12779
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions common/app/model/CardStylePicker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +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.toLowerCase() == "specialreportalt") SpecialReportAlt else SpecialReport
case campaign :: Nil if campaign.id.toString.toLowerCase() == "specialreportalt" => SpecialReportAlt
case _ => SpecialReport
}
}
Expand All @@ -23,8 +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.toLowerCase() == "specialreportalt") SpecialReportAlt else SpecialReport
case campaign :: Nil if campaign.id.toString.toLowerCase() == "specialreportalt" => SpecialReportAlt
case _ => SpecialReport
}
}
Expand Down

0 comments on commit 6d12779

Please sign in to comment.