diff --git a/src/screens/Analytics/AnalyticsUtils.res b/src/screens/Analytics/AnalyticsUtils.res index 0ffb13823..f667c9f59 100644 --- a/src/screens/Analytics/AnalyticsUtils.res +++ b/src/screens/Analytics/AnalyticsUtils.res @@ -785,3 +785,12 @@ type getFilters = { endTime: string, filterValueFromUrl?: JSON.t, } + +let filterMetrics = metrics => { + metrics->Array.filter(ele => { + let metricName = ele->getDictFromJsonObject->getString("name", "") + !String.includes(metricName, "sessionized") && + metricName != "failure_reasons" && + metricName != "payments_distribution" + }) +} diff --git a/src/screens/Analytics/DisputeAnalytics/DisputeAnalytics.res b/src/screens/Analytics/DisputeAnalytics/DisputeAnalytics.res index 428807c07..b3cc12850 100644 --- a/src/screens/Analytics/DisputeAnalytics/DisputeAnalytics.res +++ b/src/screens/Analytics/DisputeAnalytics/DisputeAnalytics.res @@ -16,7 +16,12 @@ let make = () => { try { let infoUrl = getURL(~entityName=ANALYTICS_DISPUTES, ~methodType=Get, ~id=Some("dispute")) let infoDetails = await fetchDetails(infoUrl) - setMetrics(_ => infoDetails->getDictFromJsonObject->getArrayFromDict("metrics", [])) + let metrics = + infoDetails + ->getDictFromJsonObject + ->getArrayFromDict("metrics", []) + ->AnalyticsUtils.filterMetrics + setMetrics(_ => metrics) setDimensions(_ => infoDetails->getDictFromJsonObject->getArrayFromDict("dimensions", [])) setScreenState(_ => PageLoaderWrapper.Success) } catch { diff --git a/src/screens/Analytics/PaymentsAnalytics/PaymentAnalytics.res b/src/screens/Analytics/PaymentsAnalytics/PaymentAnalytics.res index 7e633c1ea..f4a2daa30 100644 --- a/src/screens/Analytics/PaymentsAnalytics/PaymentAnalytics.res +++ b/src/screens/Analytics/PaymentsAnalytics/PaymentAnalytics.res @@ -29,12 +29,7 @@ let make = () => { infoDetails ->getDictFromJsonObject ->getArrayFromDict("metrics", []) - ->Array.filter(ele => { - let metricName = ele->getDictFromJsonObject->getString("name", "") - !String.includes(metricName, "sessionized") && - metricName != "failure_reasons" && - metricName != "payments_distribution" - }) + ->AnalyticsUtils.filterMetrics setMetrics(_ => ignoreSessionizedPayment) setDimensions(_ => infoDetails->getDictFromJsonObject->getArrayFromDict("dimensions", [])) setScreenState(_ => PageLoaderWrapper.Success) diff --git a/src/screens/Analytics/RefundsAnalytics/RefundsAnalytics.res b/src/screens/Analytics/RefundsAnalytics/RefundsAnalytics.res index 747136220..708b71e17 100644 --- a/src/screens/Analytics/RefundsAnalytics/RefundsAnalytics.res +++ b/src/screens/Analytics/RefundsAnalytics/RefundsAnalytics.res @@ -16,7 +16,12 @@ let make = () => { try { let infoUrl = getURL(~entityName=ANALYTICS_REFUNDS, ~methodType=Get, ~id=Some(domain)) let infoDetails = await fetchDetails(infoUrl) - setMetrics(_ => infoDetails->getDictFromJsonObject->getArrayFromDict("metrics", [])) + let metrics = + infoDetails + ->getDictFromJsonObject + ->getArrayFromDict("metrics", []) + ->AnalyticsUtils.filterMetrics + setMetrics(_ => metrics) setDimensions(_ => infoDetails->getDictFromJsonObject->getArrayFromDict("dimensions", [])) setScreenState(_ => PageLoaderWrapper.Success) } catch {