Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(retention): fix showing mean #29374

Merged
merged 1 commit into from
Feb 28, 2025
Merged

fix(retention): fix showing mean #29374

merged 1 commit into from
Feb 28, 2025

Conversation

anirudhpillai
Copy link
Contributor

Problem

https://posthog.slack.com/archives/C0368RPHLQH/p1740768734994999

Changes

Check length before showing mean

Does this work well for both Cloud and self-hosted?

Yes

How did you test this code?

Tested locally

@anirudhpillai anirudhpillai requested a review from a team February 28, 2025 19:09
@anirudhpillai anirudhpillai enabled auto-merge (squash) February 28, 2025 19:09
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR fixes a bug in the retention table's mean calculation by adding a boundary check for column indices.

  • Added a condition in frontend/src/scenes/retention/RetentionTable.tsx to prevent accessing out-of-bounds indices when calculating mean percentages
  • The fix handles cases where some retention cohorts have fewer data points than others, preventing potential errors
  • The change ensures the mean calculation properly skips columns that don't exist for certain rows
  • Improves robustness of the retention table when displaying mean values across cohorts with varying data availability

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

Size Change: 0 B

Total Size: 9.73 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 9.73 MB

compressed-size-action

@anirudhpillai anirudhpillai merged commit cbf88b2 into master Feb 28, 2025
94 of 96 checks passed
@anirudhpillai anirudhpillai deleted the fix/retention-mean branch February 28, 2025 19:20
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (wasn't pushed!)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants