From f44f6685c48172148ac751d2cdd003d6c2c778fd Mon Sep 17 00:00:00 2001 From: Daniel Bachler Date: Wed, 6 Dec 2023 15:15:07 +0100 Subject: [PATCH] :hammer: fix a subtle bug that opened the wrong covid explorer view in redirects --- explorer/urlMigrations/LegacyCovidUrlMigration.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/explorer/urlMigrations/LegacyCovidUrlMigration.ts b/explorer/urlMigrations/LegacyCovidUrlMigration.ts index d3c212a73ab..6811f8214d2 100644 --- a/explorer/urlMigrations/LegacyCovidUrlMigration.ts +++ b/explorer/urlMigrations/LegacyCovidUrlMigration.ts @@ -57,7 +57,7 @@ const covidIntervalFromLegacyQueryParams = (queryParams: QueryParams) => { } const boolParamToString = (bool: boolean | string | undefined) => - bool ? "true" : "false" + bool === "true" || bool === "false" ? bool : bool ? "true" : "false" const legacyToCurrentCovidQueryParams = ( queryParams: QueryParams, @@ -101,16 +101,16 @@ const legacyToCurrentCovidQueryParams = ( "Align outbreaks": boolParamToString( queryParams["Align outbreaks"] ?? baseQueryParams["Align outbreaks"] ?? - urlContainsMetric - ? queryParams.aligned - : baseQueryParams.aligned + (urlContainsMetric + ? queryParams.aligned + : baseQueryParams.aligned) ), "Relative to Population": boolParamToString( queryParams["Relative to Population"] ?? baseQueryParams["Relative to Population"] ?? - urlContainsMetric - ? queryParams.perCapita - : baseQueryParams.perCapita + (urlContainsMetric + ? queryParams.perCapita + : baseQueryParams.perCapita) ), }