Skip to content

Commit

Permalink
Move category filtering so it influences winner over time
Browse files Browse the repository at this point in the history
  • Loading branch information
emerick committed Aug 9, 2019
1 parent fc10e05 commit c928e2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ deps = {
"vendor/bat-native-tweetnacl": "/~https://github.com/brave-intl/bat-native-tweetnacl.git@1b4362968c8f22720bfb75af6f506d4ecc0f3116",
"components/brave_sync/extension/brave-sync": "/~https://github.com/brave/sync.git@e97e9e912552cd789cb2c1b1f327c77b32175317",
"components/brave_sync/extension/brave-crypto": "/~https://github.com/brave/crypto@0231e65ba211b152d742278319c545a83cb13fc0",
"vendor/bat-native-usermodel": "/~https://github.com/brave-intl/bat-native-usermodel.git@c1745b906079285fc01e3079ac49b0e65fde0f98",
"vendor/bat-native-usermodel": "/~https://github.com/brave-intl/bat-native-usermodel.git@a82acda22d8cb255d86ee28734efb8ad886e9a49",
"vendor/challenge_bypass_ristretto_ffi": "/~https://github.com/brave-intl/challenge-bypass-ristretto-ffi.git@f88d942ddfaf61a4a6703355a77c4ef71bc95c35",
}

Expand Down
17 changes: 9 additions & 8 deletions vendor/bat-native-ads/src/bat/ads/internal/ads_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,14 @@ std::string AdsImpl::GetWinnerOverTimeCategory() {
}

for (size_t i = 0; i < page_score.size(); i++) {
auto taxonomy = user_model_->GetTaxonomyAtIndex(i);
if (client_->IsFilteredCategory(taxonomy)) {
BLOG(INFO) << taxonomy
<< " taxonomy has been excluded from the winner over time";

continue;
}

winner_over_time_page_score[i] += page_score[i];
}
}
Expand All @@ -637,7 +645,7 @@ std::string AdsImpl::GetWinnerOverTimeCategory() {

std::string AdsImpl::GetWinningCategory(
const std::vector<double>& page_score) {
return user_model_->WinningCategory(page_score);
return user_model_->GetWinningCategory(page_score);
}

std::string AdsImpl::GetWinningCategory(const std::string& html) {
Expand Down Expand Up @@ -848,13 +856,6 @@ void AdsImpl::ServeAdFromCategory(const std::string& category) {
return;
}

if (client_->IsFilteredCategory(category)) {
BLOG(INFO) << "Notification not made: category \"" << category
<< "\" appears in filtered categories list";

return;
}

auto callback = std::bind(&AdsImpl::OnGetAds, this, _1, _2, _3);
ads_client_->GetAds(category, callback);
}
Expand Down

0 comments on commit c928e2d

Please sign in to comment.