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

Handle survey_response cells when searching in view #1199

Merged
merged 1 commit into from
Dec 4, 2020

Conversation

richardolsson
Copy link
Member

This PR handles cells in survey_response columns properly when searching in a view. These cells include an array of objects, each object representing a response to the given survey question. The logic merges the array into a single string and searches it the same way that regular search in text-based cells work.

Fixes #1142

@niklasva82
Copy link
Member

I'm not sure I understand how this PR changes things. It concacenates an entire survey and searches through the entire thing is my understanding, but how do I select an enitre survey? When I try, this is what happens.
Peek 2020-12-04 14-48

@richardolsson
Copy link
Member Author

richardolsson commented Dec 4, 2020

You are not adding a survey_response column (because you are not picking a question). The pull request adds feature to search. You already have to survey_response columns in this view. Try searching in the View (just next to the download button) for "this is", which will find Angela due to her survey response that you've added to the view.

@richardolsson
Copy link
Member Author

It concacenates an entire survey and searches through the entire thing is my understanding

That's not correct. The survey_response column returns an array of responses to a single question, in case that question was answered many times be a single person. In most cases it will have 0 or 1 entry, but in some cases (whey a person answers the same survey more than once) it will have more than 1 entry.

The old logic of searching just understood text cells, but this is a cell which contains an array. The new code joins the array entries within a single cell into a single string of text, and searches that.

@niklasva82
Copy link
Member

Ah okay now it makes sense! It was the array that I was confused about.

Copy link
Member

@niklasva82 niklasva82 left a comment

Choose a reason for hiding this comment

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

Great! Works and code looks good!

@richardolsson
Copy link
Member Author

Ah okay now it makes sense! It was the array that I was confused about.

Cool! I think what you've found (adding a column without finishing all the options) is a bug though. I will log it separately!

@richardolsson
Copy link
Member Author

Logged the bug you found as #1200.

@richardolsson richardolsson merged commit d8d95d6 into master Dec 4, 2020
@richardolsson richardolsson deleted the enhancement/view-filter-survey-response branch December 4, 2020 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter in view based on survey responses
2 participants