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

Do not show 0% after normalization #2428

Merged
merged 1 commit into from
May 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion components/brave_rewards/browser/rewards_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2829,7 +2829,9 @@ void RewardsServiceImpl::OnPublisherListNormalizedSaved(

ContentSiteList site_list;
for (auto& publisher : *list) {
site_list.push_back(PublisherInfoToContentSite(publisher));
if (publisher.percent >= 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is the right place to do this. This is UI logic and should be filtered by the UI, not by RewardsServiceImpl

Copy link
Collaborator

Choose a reason for hiding this comment

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

also there should be a test for this

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 was added here as other (sort is here as well) that is then sent to UI. Left comment here how I want to solve it https://github.com/brave/brave-core/pull/2432/files#r283678712

Copy link
Collaborator

@bridiver bridiver May 15, 2019

Choose a reason for hiding this comment

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

The sort is also here which is UI, but I think even short-term it would be better to move both of those to the UI class OnPublisherListNormalized observer method. I think we're all on the same page now that we should be doing the calculations at query time and dumping the serialized normalization? If not let's discuss in slack with @tmancey as well

site_list.push_back(PublisherInfoToContentSite(publisher));
}
}

sort(site_list.begin(), site_list.end());
Expand Down