Skip to content

Commit

Permalink
fix: filter sessionized metrics (#1761)
Browse files Browse the repository at this point in the history
Co-authored-by: prajwalnl0 <[email protected]>
  • Loading branch information
sagarnaikjuspay and prajwalnl0 authored Nov 19, 2024
1 parent 1ad7cae commit 8ab03a6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
9 changes: 9 additions & 0 deletions src/screens/Analytics/AnalyticsUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -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"
})
}
7 changes: 6 additions & 1 deletion src/screens/Analytics/DisputeAnalytics/DisputeAnalytics.res
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 1 addition & 6 deletions src/screens/Analytics/PaymentsAnalytics/PaymentAnalytics.res
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion src/screens/Analytics/RefundsAnalytics/RefundsAnalytics.res
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 8ab03a6

Please sign in to comment.