-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: new filters for surveys answers #28466
Conversation
Size Change: 0 B Total Size: 1.21 MB ℹ️ View Unchanged
|
acbcce5
to
b7b1455
Compare
b7b1455
to
00c5983
Compare
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
There was a problem hiding this 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 introduces a new dedicated survey answer filtering system that significantly improves the user experience. Here's a concise summary of the key changes:
- Added new
SurveyAnswerFilters
component with an intuitive table-based UI for filtering survey responses by question - Implemented type-specific filter operators (e.g., contains, exact match) for different question types (Open, Rating, SingleChoice, MultipleChoice)
- Added debounced result reloading when filters change to prevent excessive API calls
- Added comprehensive test coverage for the new filtering functionality in
surveyLogic.test.ts
- Integrated loading states to provide better feedback during filter operations
The changes make survey result filtering more accessible and efficient by reducing the number of clicks needed and providing question-specific filtering options directly in the UI.
4 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile
// Initialize answer filters for all questions | ||
const initialFilters = survey.questions.map((question, index) => ({ | ||
key: index === 0 ? '$survey_response' : `$survey_response_${index}`, | ||
operator: DEFAULT_OPERATORS[question.type].value, | ||
type: PropertyFilterType.Event as const, | ||
value: [], | ||
})) | ||
actions.setAnswerFilters(initialFilters) | ||
return survey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider adding error handling for invalid question types when initializing filters
0408a4d
to
204f715
Compare
actions.updateSurvey({ archived: true }) | ||
}, | ||
loadSurveySuccess: () => { | ||
listeners(({ actions, values }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
miss leading number of lines changed here.
since I added this new function, reloadAllSurveysResults
, it shifted a lot of things down.
but the main changes are using switch
case instead of multiple ifs and elses, and using this new function on both setPropertyFilters
and setAnswersFilters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor comments/notes 👍
onSet={(value: any) => handleUpdateFilter(index, 'value', value)} | ||
placeholder={ | ||
question.type === SurveyQuestionType.Rating | ||
? 'Enter a number' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly as a future improvement, but in case of ratings we could borrow some of the filtering logic we use when setting up conditional questions (e.g Detractors, Passives, Promoters or Negative, Neutral, Positive). This way users can quickly filter for those groups of people
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#28813 created as a new issue to address later. I agree, great suggestion
📸 UI snapshots have been updated2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
Triggered by this commit. |
cd250b4
to
d99c052
Compare
📸 UI snapshots have been updated2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
Triggered by this commit. |
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Problem
Right now, if you want to filter the survey results, you have to go through a lot of clicks:
The process is not very intuitive, as we have to select by "Survey Response X" instead of the question name.
It's also painful, as said by other customers too.
Changes
see the demo here
Adds a new dedicated filters component for a survey's answers.
Does this work well for both Cloud and self-hosted?
Yes
How did you test this code?
Unit tests for
surveyLogic
Manual tests for all question types