diff --git a/frontend/src/scenes/experiments/ExperimentView/Overview.tsx b/frontend/src/scenes/experiments/ExperimentView/Overview.tsx index 1b6bef968971a..b1c75665a82b0 100644 --- a/frontend/src/scenes/experiments/ExperimentView/Overview.tsx +++ b/frontend/src/scenes/experiments/ExperimentView/Overview.tsx @@ -12,20 +12,18 @@ export function Overview(): JSX.Element { experimentResults, getIndexForVariant, experimentInsightType, + sortedConversionRates, getHighestProbabilityVariant, areResultsSignificant, - conversionRateForVariant, } = useValues(experimentLogic) function WinningVariantText(): JSX.Element { - const winningVariant = getHighestProbabilityVariant(experimentResults) - if (experimentInsightType === InsightType.FUNNELS) { - const winningConversionRate = conversionRateForVariant(experimentResults, winningVariant || '') - const controlConversionRate = conversionRateForVariant(experimentResults, 'control') - const difference = parseFloat(winningConversionRate) - parseFloat(controlConversionRate) + const winningVariant = sortedConversionRates[0] + const secondBestVariant = sortedConversionRates[1] + const difference = winningVariant.conversionRate - secondBestVariant.conversionRate - if (difference === 0) { + if (winningVariant.conversionRate === secondBestVariant.conversionRate) { return ( No variant is winning at this moment.  @@ -35,28 +33,29 @@ export function Overview(): JSX.Element { return (
- +  is winning with a conversion rate  increase of {`${difference.toFixed(2)}%`}  percentage points (vs  - + ). 
) } - const index = getIndexForVariant(experimentResults, winningVariant || '') - if (winningVariant && index !== null && experimentResults) { + const highestProbabilityVariant = getHighestProbabilityVariant(experimentResults) + const index = getIndexForVariant(experimentResults, highestProbabilityVariant || '') + if (highestProbabilityVariant && index !== null && experimentResults) { const { probability } = experimentResults return (
- +  is winning with a  - {`${(probability[winningVariant] * 100).toFixed(2)}% probability`}  + {`${(probability[highestProbabilityVariant] * 100).toFixed(2)}% probability`}  of being best.