From c2c0ed185024b7e2f67d09dd92d9615a00296e82 Mon Sep 17 00:00:00 2001 From: Georges Lebreton <102960844+Georges-GNM@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:15:19 +0000 Subject: [PATCH] scalafmt --- app/controllers/StoriesVisibleController.scala | 6 +++++- app/services/CollectionService.scala | 2 +- app/services/ContainerService.scala | 11 +++++++++-- app/slices/FlexibleContainer.scala | 17 +++++++++++++---- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/app/controllers/StoriesVisibleController.scala b/app/controllers/StoriesVisibleController.scala index 09978a5231..6e708a1cbd 100644 --- a/app/controllers/StoriesVisibleController.scala +++ b/app/controllers/StoriesVisibleController.scala @@ -22,7 +22,11 @@ class StoriesVisibleController( def storiesVisible(containerType: String) = AccessAPIAuthAction(parse.json[StoriesVisibleRequest]) { implicit request => val storiesVisible = - containerService.getStoriesVisible(containerType, request.body.stories, collectionConfigJson = null) + containerService.getStoriesVisible( + containerType, + request.body.stories, + collectionConfigJson = null + ) logger.info( s"got stories-visible=$storiesVisible for containerType=$containerType" diff --git a/app/services/CollectionService.scala b/app/services/CollectionService.scala index cc2caa7037..03239eebad 100644 --- a/app/services/CollectionService.scala +++ b/app/services/CollectionService.scala @@ -97,7 +97,7 @@ object CollectionService { config: ConfigJson, containerService: ContainerService ): Option[StoriesVisibleByStage] = { - val cConfigJson = config.collections.get(collectionId).get + val cConfigJson = config.collections.get(collectionId).get val stages = CollectionService.getStoriesForCollectionStages(collectionId, collection) config.collections.get(collectionId).flatMap(_.`type`) match { diff --git a/app/services/ContainerService.scala b/app/services/ContainerService.scala index 439712d6b8..7e472edba5 100644 --- a/app/services/ContainerService.scala +++ b/app/services/ContainerService.scala @@ -15,7 +15,11 @@ object StoriesVisibleResponse { } class ContainerService(val containers: Containers) { - def getStoriesVisible(containerType: String, stories: Seq[Story], collectionConfigJson: CollectionConfigJson) = { + def getStoriesVisible( + containerType: String, + stories: Seq[Story], + collectionConfigJson: CollectionConfigJson + ) = { val numberOfStories = stories.length containers.all.get(containerType) map { case Fixed(container) => @@ -49,7 +53,10 @@ class ContainerService(val containers: Containers) { ) case Flexible(container) => - val numberVisible = container.storiesVisible(stories, collectionConfigJson: CollectionConfigJson) + val numberVisible = container.storiesVisible( + stories, + collectionConfigJson: CollectionConfigJson + ) StoriesVisibleResponse( Some(numberVisible), Some(numberVisible) diff --git a/app/slices/FlexibleContainer.scala b/app/slices/FlexibleContainer.scala index f65e51ae78..5590bdd109 100644 --- a/app/slices/FlexibleContainer.scala +++ b/app/slices/FlexibleContainer.scala @@ -2,18 +2,24 @@ package slices import com.gu.facia.client.models.CollectionConfigJson trait FlexibleContainer { - def storiesVisible(stories: Seq[Story], collectionConfigJson: CollectionConfigJson): Int + def storiesVisible( + stories: Seq[Story], + collectionConfigJson: CollectionConfigJson + ): Int } object FlexibleGeneral extends FlexibleContainer { - def storiesVisible(stories: Seq[Story], collectionConfigJson: CollectionConfigJson): Int = { + def storiesVisible( + stories: Seq[Story], + collectionConfigJson: CollectionConfigJson + ): Int = { val byGroup = Story.segmentByGroup(stories) val splash = byGroup.getOrElse(3, Seq.empty) ++ byGroup.getOrElse(2, Seq.empty) ++ byGroup.getOrElse(1, Seq.empty) val numOfSplash = splash.size min 1 val numOfStandard = stories.size - numOfSplash - val defaultStandardStoryLimit = 8 + val defaultStandardStoryLimit = 8 val standardStoryLimit = collectionConfigJson.displayHints .flatMap(_.maxItemsToDisplay) @@ -24,7 +30,10 @@ object FlexibleGeneral extends FlexibleContainer { } object FlexibleSpecial extends FlexibleContainer { - def storiesVisible(stories: Seq[Story], collectionConfigJson: CollectionConfigJson): Int = { + def storiesVisible( + stories: Seq[Story], + collectionConfigJson: CollectionConfigJson + ): Int = { val byGroup = Story.segmentByGroup(stories) val snap = byGroup.getOrElse(3, Seq.empty) ++ byGroup.getOrElse(2, Seq.empty) ++