From 9ce318261494e202b81510b8dcc068ccf14a3f78 Mon Sep 17 00:00:00 2001 From: Dominik Lander Date: Thu, 23 May 2024 18:47:54 +0100 Subject: [PATCH] Get most read by location in new route --- onward/app/controllers/MostPopularController.scala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/onward/app/controllers/MostPopularController.scala b/onward/app/controllers/MostPopularController.scala index 140e86c48de6..41025cceeea2 100644 --- a/onward/app/controllers/MostPopularController.scala +++ b/onward/app/controllers/MostPopularController.scala @@ -206,7 +206,16 @@ class MostPopularController( def renderWithDeeplyRead(): Action[AnyContent] = Action.async { implicit request => - val edition = Edition(request) + val headers = request.headers.toSimpleMap + val countryCode = headers.getOrElse("X-GU-GeoLocation", "country:row").replace("country:", "") + val edition = countryCode match { + case "GB" => editions.Uk + case "US" => editions.Us + case "CA" => editions.Us + case "AU" => editions.Au + case "NZ" => editions.Au + case _ => Edition.defaultEdition + } // Synchronous edition popular, from the mostPopularAgent (stateful) val editionPopular: Option[MostPopularCollectionResponse] = {