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

Force recommended results to the top when sorting from a Category page #8103

Merged

Conversation

bobsilverberg
Copy link
Contributor

@codecov-io
Copy link

codecov-io commented May 29, 2019

Codecov Report

Merging #8103 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   mozilla/addons-frontend#8103      +/-   ##
=========================================
+ Coverage   98.09%   98.1%   +<.01%     
=========================================
  Files         260     260              
  Lines        7363    7370       +7     
  Branches     1331    1333       +2     
=========================================
+ Hits         7223    7230       +7     
  Misses        126     126              
  Partials       14      14
Impacted Files Coverage Δ
src/amo/components/SearchFilters/index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32c493b...0c5bf3a. Read the comment docs.

@willdurand willdurand self-assigned this Jun 3, 2019
Copy link
Member

@willdurand willdurand left a comment

Choose a reason for hiding this comment

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

r+wc

I left two questions because I feel like we could do better, but that could be done later, maybe.

@@ -30,6 +31,7 @@ import Select from 'ui/components/Select';
import './styles.scss';

const NO_FILTER = '';
const sortSelectName = 'sort';
Copy link
Member

Choose a reason for hiding this comment

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

Could you use paramsToFilter.sort from src/core/searchUtils.js instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. I think I'll keep sortSelectName but set it to paramsToFilter.sort. I'm not sure if you meant to get rid of it entirely and just use paramsToFilter.sort in the code, but I think having the name makes it clearer that there's a relationship between the two uses.

Copy link
Member

Choose a reason for hiding this comment

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

It's fine to keep sortSelectName :)

expect(root.find('.SearchFilters-Sort')).toHaveProp('value', sort);
});

it('selects the second sort criterion in the sort select when there are two criteria', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we try to select the criterion that is not recommended instead or should we have a multiple select?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the idea of making the the first criterion that is not recommended, so I've implemented that change. I don't think we want to complicate it by allowing the user to select multiple sort criteria (in which case they'd also have to be able to specify which is the first sort and which is the second), but we can open that up for debate and a follow-up could be filed for that.

@jvillalobos Do you think we should enhance the sort form to allow users to specify multiple sort fields (now that we're sometimes forcing the recommended sort as the first criterion)?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, I don't think that will be necessary. Prioritizing recommended extensions should be invisible to the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I don't think that will be necessary. Prioritizing recommended extensions should be invisible to the user.

Well, it won't be invisible if they look at the URL, but it won't be evident from the form. I assume that is acceptable?

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.

Force recommended results to the top when sorting from a Category page
4 participants