Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
webjunkie committed Aug 8, 2024
1 parent 4512c2c commit aeab2fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions frontend/src/scenes/retention/RetentionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,13 @@ export function RetentionModal(): JSX.Element | null {
<tr>
<th>{capitalizeFirstLetter(aggregationTargetLabel.singular)}</th>
{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

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/retention/retentionTableLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const retentionTableLogic = kea<retentionTableLogicType>([
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
Expand Down

0 comments on commit aeab2fa

Please sign in to comment.