From e083fbbcebe95a79482e2a6ba468b4ed1bf7bc6c Mon Sep 17 00:00:00 2001 From: Max Duval Date: Wed, 12 Jun 2024 09:37:07 +0100 Subject: [PATCH 1/3] fix: make types overlap --- common/app/model/PressedPage.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/app/model/PressedPage.scala b/common/app/model/PressedPage.scala index 2ecc49078ec..cbbcb1e7e82 100644 --- a/common/app/model/PressedPage.scala +++ b/common/app/model/PressedPage.scala @@ -134,8 +134,12 @@ case class PressedPage( item <- pressedCollection.curatedPlusBackfillDeduplicated id <- { item match { - case curatedContent: CuratedContent => - curatedContent.content.sectionId ++ curatedContent.content.tags.map(_.id) + case curatedContent: pressed.CuratedContent => { + curatedContent.properties.maybeContent match { + case Some(content) => content.metadata.sectionId.map(_.value) ++ content.tags.tags.map(_.id) + case None => List.empty + } + } case _ => Nil } } From 48a1ea7e83650e3fe47f269de662f739923102ad Mon Sep 17 00:00:00 2001 From: Max Duval Date: Wed, 12 Jun 2024 09:50:42 +0100 Subject: [PATCH 2/3] refactor: Nil is the empty list --- common/app/model/PressedPage.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/app/model/PressedPage.scala b/common/app/model/PressedPage.scala index cbbcb1e7e82..c8749128279 100644 --- a/common/app/model/PressedPage.scala +++ b/common/app/model/PressedPage.scala @@ -137,7 +137,7 @@ case class PressedPage( case curatedContent: pressed.CuratedContent => { curatedContent.properties.maybeContent match { case Some(content) => content.metadata.sectionId.map(_.value) ++ content.tags.tags.map(_.id) - case None => List.empty + case None => Nil } } case _ => Nil From 0eb8e321abfa5e77ae6c92aa62d60e131e3532ff Mon Sep 17 00:00:00 2001 From: Max Duval Date: Wed, 12 Jun 2024 10:14:01 +0100 Subject: [PATCH 3/3] refactor: clearer access Co-Authored-By: Anna Beddow --- common/app/model/PressedPage.scala | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/common/app/model/PressedPage.scala b/common/app/model/PressedPage.scala index c8749128279..074533f078d 100644 --- a/common/app/model/PressedPage.scala +++ b/common/app/model/PressedPage.scala @@ -134,12 +134,10 @@ case class PressedPage( item <- pressedCollection.curatedPlusBackfillDeduplicated id <- { item match { - case curatedContent: pressed.CuratedContent => { - curatedContent.properties.maybeContent match { - case Some(content) => content.metadata.sectionId.map(_.value) ++ content.tags.tags.map(_.id) - case None => Nil - } - } + case curatedContent: pressed.CuratedContent => + curatedContent.properties.maybeContent + .map(content => content.metadata.sectionId.map(_.value) ++ content.tags.tags.map(_.id)) + .getOrElse(Nil) case _ => Nil } }