Skip to content

Commit

Permalink
chore: update smart-retry
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 committed Oct 28, 2024
1 parent c1e517c commit 5c995ef
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ open BarGraphTypes
open FailedPaymentsDistributionUtils

module TableModule = {
open FailedPaymentsDistributionTypes
@react.component
let make = (~data, ~className="", ~selectedTab: string, ~isSmartRetryEnabled) => {
let make = (~data, ~className="", ~selectedTab: string) => {
open LogicUtils
let (offset, setOffset) = React.useState(_ => 0)
let {filterValueJson} = React.useContext(FilterContext.filterContext)
let isSmartRetryEnabled =
filterValueJson->getString("is_smart_retry_enabled", "true")->getBoolFromString(true)
let defaultSort: Table.sortedObject = {
key: "",
order: Table.INC,
}
let tableBorderClass = "border-2 border-solid border-jp-gray-940 border-collapse border-opacity-30 dark:border-jp-gray-dark_table_border_color dark:border-opacity-30"
let defaultCol = isSmartRetryEnabled
? Payments_Failure_Rate_Distribution
: Payments_Failure_Rate_Distribution_Without_Smart_Retries

let defaultCol = isSmartRetryEnbldForFailedPmtDist(
isSmartRetryEnabled->NewPaymentAnalyticsUtils.getSmartRetryMetricType,
)
let visibleColumns = [defaultCol]->Array.concat([selectedTab->getColumn])
let tableData = getTableData(data)

Expand Down Expand Up @@ -154,10 +158,7 @@ let make = (
/>
| Table =>
<TableModule
data={failedPaymentsDistribution}
className="mx-7"
selectedTab={groupBy.value}
isSmartRetryEnabled
data={failedPaymentsDistribution} className="mx-7" selectedTab={groupBy.value}
/>
}}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,10 @@ let getKeyForModule = (field, ~isSmartRetryEnabled) => {
Payments_Failure_Rate_Distribution_Without_Smart_Retries
}->getStringFromVariant
}

let isSmartRetryEnbldForFailedPmtDist = isEnabled => {
switch isEnabled {
| Smart_Retry => Payments_Failure_Rate_Distribution
| Default => Payments_Failure_Rate_Distribution_Without_Smart_Retries
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ let tooltipFormatter = (~secondaryCategories, ~title, ~metricType) => {
)->asTooltipPointFormatter
}

let getMetricType = is_smart_retry_enabled => {
let getSmartRetryMetricType = isSmartRetryEnabled => {
open NewAnalyticsTypes
switch is_smart_retry_enabled {
switch isSmartRetryEnabled {
| true => Smart_Retry
| false => Default
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let make = (~entity: moduleEntity) => {
filterValueJson
->getString("is_smart_retry_enabled", "true")
->getBoolFromString(true)
->NewPaymentAnalyticsUtils.getMetricType
->NewPaymentAnalyticsUtils.getSmartRetryMetricType

let getData = async () => {
setScreenState(_ => PageLoaderWrapper.Loading)
Expand Down

0 comments on commit 5c995ef

Please sign in to comment.