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

Surveys: Wrong graph series after changing question order #27200

Open
ioannisj opened this issue Dec 31, 2024 · 5 comments
Open

Surveys: Wrong graph series after changing question order #27200

ioannisj opened this issue Dec 31, 2024 · 5 comments
Labels
bug Something isn't working right feature/surveys

Comments

@ioannisj
Copy link
Contributor

ioannisj commented Dec 31, 2024

Bug description

related customer ticket: https://posthoghelp.zendesk.com/agent/tickets/22201

After changing the order of the questions in a survey, the graphs in the results seems to mix-up answers from different questions

At surveys, we rely on the question index in the array to determine which question we're showing. We're sort of using it as an id.

That means it must remain stable after launching the survey, otherwise the answers will be messed up in the data.

We did a band-aid fix to prevent re-ordering after launching a survey.

So, when we have the time, we should update our BE schema to store the questions relying on an ID instead of relying on their position in the array. This way we can again support question re-ordering after launching a survey.

Some caveats

Questions are currently stored as a JSON field in the DB.

So, if we update it to use an ID for every question, it means a breaking change in the database. So we'll have to support both versions indefinitely. Unless we come up with a better plan.

If this ID is added, we need to make sure that, on our logic, we support both survey's versions.

@ioannisj ioannisj added the bug Something isn't working right label Dec 31, 2024
@marandaneto
Copy link
Member

cc @lucasheriques

@marandaneto
Copy link
Member

Can be related to #19820

@marandaneto
Copy link
Member

@lucasheriques did you check if we could use the originalQuestionIndex for fixing this altogether?

@lucasheriques
Copy link
Contributor

@marandaneto it can't as this is a value that's computed on the client side. after it's changed in PostHog's UI, we no longer know which one was the original

@marandaneto
Copy link
Member

@marandaneto it can't as this is a value that's computed on the client side. after it's changed in PostHog's UI, we no longer know which one was the original

why is the API returning this value then? where does it get from?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right feature/surveys
Projects
None yet
Development

No branches or pull requests

3 participants