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

feat(surveys): Single Choice question results #17923

Merged
merged 5 commits into from
Oct 12, 2023

Conversation

jurajmajerik
Copy link
Contributor

@jurajmajerik jurajmajerik commented Oct 11, 2023

@corywatilo

Screenshot 2023-10-11 at 15 08 24 Screenshot 2023-10-11 at 15 10 57

Copy link
Contributor

@neilkakkar neilkakkar left a comment

Choose a reason for hiding this comment

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

will test it out shortly, but this is looking great nice job! :D

frontend/src/scenes/surveys/surveyLogic.tsx Outdated Show resolved Hide resolved
frontend/src/scenes/surveys/surveyViewViz.tsx Outdated Show resolved Hide resolved
frontend/src/scenes/surveys/surveyLogic.tsx Show resolved Hide resolved
@@ -314,7 +358,15 @@ export const surveyLogic = kea<surveyLogicType>([
{},
{
loadSurveyRatingResultsSuccess: (state, { payload }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is this being used btw? I can't find any references to it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This sets surveySingleChoiceResultsReady - an object of booleans where the key represents the index of the question for which we are fetching results.

Each chart does its own fetching, so we need to store the loading state separately for each. Same goes for the results, which we store in surveySingleChoiceResults - also an object of question indices.

@corywatilo
Copy link
Contributor

Looks good! Let's maybe double the height of the pie?

And cut the padding between legend items by 50%. Then we can stack more items in a single column before having to split to 2 columns.

@jurajmajerik
Copy link
Contributor Author

@corywatilo sizes adjusted:

Screenshot 2023-10-12 at 08 11 49 Screenshot 2023-10-12 at 08 11 17

{},
{
loadSurveySingleChoiceResultsSuccess: (state, { payload }) => {
return { ...state, [`${payload?.questionIndex}`]: true }
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need some error handling here since that should be the only case when questionIndex doesn't exist in the payload and this incorrectly adds 'true' to undefined.

(and a more general error state for when the hogql query fails, vanishing / infinite loading the graph is suboptimal) - but ok to do in a follow up

frontend/src/scenes/surveys/surveyViewViz.tsx Outdated Show resolved Hide resolved
@jurajmajerik jurajmajerik enabled auto-merge (squash) October 12, 2023 10:22
@jurajmajerik jurajmajerik merged commit eaef6cd into master Oct 12, 2023
@jurajmajerik jurajmajerik deleted the surveys/singlechoice-question-results branch October 12, 2023 10:53
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.

4 participants