From aeab2fa197892e386ecac6f6d2b90781dd6b5f09 Mon Sep 17 00:00:00 2001 From: Julian Bez Date: Thu, 8 Aug 2024 11:27:38 +0200 Subject: [PATCH] Clean up --- frontend/src/scenes/retention/RetentionModal.tsx | 4 +--- frontend/src/scenes/retention/retentionTableLogic.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/frontend/src/scenes/retention/RetentionModal.tsx b/frontend/src/scenes/retention/RetentionModal.tsx index 9fc42d98c9f68..ef1dccca85402 100644 --- a/frontend/src/scenes/retention/RetentionModal.tsx +++ b/frontend/src/scenes/retention/RetentionModal.tsx @@ -112,15 +112,13 @@ export function RetentionModal(): JSX.Element | null { {capitalizeFirstLetter(aggregationTargetLabel.singular)} {row.values?.map((data: any, index: number) => { - // Calculate the cumulative count let cumulativeCount = data.count if (retentionFilter?.cumulative) { for (let i = index + 1; i < row.values.length; i++) { cumulativeCount += row.values[i].count } - cumulativeCount = Math.min(cumulativeCount, row.values[0].count) // Ensure cumulative count doesn't exceed total count + cumulativeCount = Math.min(cumulativeCount, row.values[0].count) } - // Calculate the percentage based on the cumulative count const percentageValue = row.values[0].count > 0 ? cumulativeCount / row.values[0].count : 0 diff --git a/frontend/src/scenes/retention/retentionTableLogic.ts b/frontend/src/scenes/retention/retentionTableLogic.ts index 3b24682b8b66e..6ba3d44a15e50 100644 --- a/frontend/src/scenes/retention/retentionTableLogic.ts +++ b/frontend/src/scenes/retention/retentionTableLogic.ts @@ -107,7 +107,7 @@ export const retentionTableLogic = kea([ for (let i = valueIndex + 1; i < currentResult.values.length; i++) { count += currentResult.values[i]['count'] } - count = Math.min(count, totalCount) // Ensure cumulative count doesn't exceed total count + count = Math.min(count, totalCount) } const percentage = totalCount > 0 ? (count / totalCount) * 100 : 0