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

Hides sites with 0% attention from the A-C table #1032

Merged
merged 1 commit into from
Dec 15, 2018
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions components/brave_rewards/browser/publisher_info_database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,10 @@ std::string PublisherInfoDatabase::BuildClauses(int start,
ledger::PUBLISHER_EXCLUDE_FILTER::FILTER_ALL_EXCEPT_EXCLUDED)
clauses += " AND pi.excluded != ?";

if (filter.percent > 0) {
clauses += " AND ai.percent >= ?";
}

for (const auto& it : filter.order_by) {
clauses += " ORDER BY " + it.first;
clauses += (it.second ? " ASC" : " DESC");
Expand Down Expand Up @@ -528,6 +532,9 @@ void PublisherInfoDatabase::BindFilter(sql::Statement& statement,
if (filter.excluded ==
ledger::PUBLISHER_EXCLUDE_FILTER::FILTER_ALL_EXCEPT_EXCLUDED)
statement.BindInt(column++, ledger::PUBLISHER_EXCLUDE::EXCLUDED);

if (filter.percent > 0)
statement.BindInt(column++, filter.percent);
}

bool PublisherInfoDatabase::InsertContributionInfo(const brave_rewards::ContributionInfo& info) {
Expand Down
1 change: 1 addition & 0 deletions components/brave_rewards/browser/rewards_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ void RewardsServiceImpl::GetCurrentContributeList(
filter.reconcile_stamp = ledger_->GetReconcileStamp();
filter.excluded =
ledger::PUBLISHER_EXCLUDE_FILTER::FILTER_ALL_EXCEPT_EXCLUDED;
filter.percent = 1;

ledger_->GetPublisherInfoList(
start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ LEDGER_EXPORT struct PublisherInfoFilter {
PUBLISHER_MONTH month;
int year;
PUBLISHER_EXCLUDE_FILTER excluded;
uint32_t percent;
std::vector<std::pair<std::string, bool>> order_by;
unsigned int min_duration;
uint64_t reconcile_stamp;
Expand Down
2 changes: 2 additions & 0 deletions vendor/bat-native-ledger/src/bat/ledger/ledger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ PublisherInfoFilter::PublisherInfoFilter() :
month(PUBLISHER_MONTH::ANY),
year(-1),
excluded(PUBLISHER_EXCLUDE_FILTER::FILTER_DEFAULT),
percent(0),
min_duration(0),
reconcile_stamp(0) {}
PublisherInfoFilter::PublisherInfoFilter(const PublisherInfoFilter& filter) :
Expand All @@ -96,6 +97,7 @@ PublisherInfoFilter::PublisherInfoFilter(const PublisherInfoFilter& filter) :
month(filter.month),
year(filter.year),
excluded(filter.excluded),
percent(filter.percent),
order_by(filter.order_by),
min_duration(filter.min_duration),
reconcile_stamp(filter.reconcile_stamp) {}
Expand Down