Closed holingpoon closed 6 years ago
Technical Notes:
utils.getSelectableTags()
should already return tags associated with books by audienceBookFilters.getFilterArray(selectableFilters, filters)
is returning a list of selectableFilters
that are in the filters
list, but the filters
list do not contain all values of selectableFilters
, hence filter array only returns the union of selectableFilters
and filters
, thereby missing some of the selectableFilters
Suggested fixes:
BookFilters.getFilterArray(selectableFilters, filters)
needs to return all the elements in selectableFilters
Logic rework
best-books
and staff-picks
since there used to be a default baseline data set. Currently, we should be returning sets with distinct values to render BookFilters
to reflect (audience, season) pair, but the code is not doing that now.This is not exactly true. utils.getSelectableTags()
will return all the tags that are available to select based on the set of picks that was passed to it. So the set of picks should already be filtered by audience when it is passed to that function. But, the function itself does not return tags associated with books by audience. This is because if you want all tags in a set of picks that contain "young adult" and "children" but NOT "adult", then it's possible to do so.
What do you mean that "the filters
list do not contain all values of selectableFilters
"? getFilterArray
does not return a union of selectableFilters
and filters
. From the filter
and _contains
functions, it is creating a list of filters of each filter in filters
array that is in the selectableFilters
array. It is okay to not have some filters from selectableFilters
in the final array. This is because a pick can have ["funny", "adventure"]
as tags but the set of official filters maybe doesn't have "funny". If that's the case, then we don't want "funny".
The problem is that the official set of filters has changed many times and it is not pulled in from one source but instead created from the tags in each pick. So yes, you could check that getFilterArray
does return all the selectable filters, but also check if we need it at all.
Thanks @EdwinGuzman! I kept searching and I found out why the filters are not rendering correctly. The API calls are not set to the new convention yet so it is returning a fixed set of data from utils.getAllTags()
. I will pair up with @gkallenberg on fixing the API routes. Thanks!
Wait, that's correct. You do want to get all the filters from the JSON response back in getAllTags
. Those are passed to the client-side and that's where they get filtered down based on aged. You could filter on the server side and that would be helpful too, but const filters = utils.getAllTags(data.picks)
should be correct because we do want to store all the filters for, say, Winter 2018.
Closing this ticket since #186 is now merged into development
When the user selects another season, the filters should reload according to the season.
When the user selects another audience, the filters should load the sub-genres.
This issue cross-references Jira Ticket WWW-214