-
Notifications
You must be signed in to change notification settings - Fork 884
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
Fixes Ads History popup shows 2 entries for the same ad (even if only served once) #3960
Conversation
6cb22fe
to
3ca1fde
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, a couple of minor nits.
std::map<uint64_t, std::vector<AdsHistory>> ads_history; | ||
base::Time now = base::Time::Now().LocalMidnight(); | ||
|
||
auto ad_history_details = client_->GetAdsShownHistory(); | ||
|
||
std::unique_ptr<AdHistoryFilter> adHistoryFilter = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: The unique_ptr
will automatically initialize to nullptr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adHistoryFilter
should use snake_case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotted - I thought I'd fixed them all... sigh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: The
unique_ptr
will automatically initialize tonullptr
.
Np, will address 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
std::deque<AdHistoryDetail> filteredAdHistoryDetails; | ||
|
||
for (auto const& adsHistoryMap : filteredAdHistory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the const
and auto
should switch positions, but maybe that's just my personal preference... :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed as consistency as we all seem to use const first at brave, google are 50/50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
vendor/bat-native-ads/src/bat/ads/internal/filters/ad_history_confirmation_filter.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ads/src/bat/ads/internal/filters/ad_history_confirmation_filter.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ads/src/bat/ads/internal/filters/ad_history_confirmation_filter.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ads/src/bat/ads/internal/filters/ad_history_confirmation_filter.cc
Outdated
Show resolved
Hide resolved
|
||
std::deque<AdHistoryDetail> filteredAdHistoryDetails; | ||
|
||
for (auto const& adsHistoryMap : filteredAdHistory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed as consistency as we all seem to use const first at brave, google are 50/50
d8c122a
to
1bfd684
Compare
@@ -550,11 +551,28 @@ void AdsImpl::SetConfirmationsIsReady( | |||
is_confirmations_ready_ = is_ready; | |||
} | |||
|
|||
std::map<uint64_t, std::vector<AdsHistory>> AdsImpl::GetAdsHistory() { | |||
std::map<uint64_t, std::vector<AdsHistory>> AdsImpl::GetAdsHistory( | |||
const Ads::AdHistoryFilterType adHistoryFilterType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: 4 spaces
vendor/bat-native-ads/src/bat/ads/internal/filters/ad_history_confirmation_filter.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ads/src/bat/ads/internal/filters/ad_history_confirmation_filter.cc
Outdated
Show resolved
Hide resolved
|
||
std::deque<AdHistoryDetail> filtered_ad_history_details; | ||
|
||
for (const auto& ads_history_map : filtered_ad_history) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need _map
? Also ads_history_map
is plural but filtered_ad_history
is not, maybe intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything in here should be 'ad_history...' something so have fixed up accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
vendor/bat-native-ads/src/bat/ads/internal/filters/ad_history_confirmation_filter.cc
Show resolved
Hide resolved
vendor/bat-native-ads/src/bat/ads/internal/filters/ad_history_confirmation_filter.cc
Show resolved
Hide resolved
vendor/bat-native-ads/src/bat/ads/internal/filters/ad_history_confirmation_filter.cc
Show resolved
Hide resolved
d3d700f
to
51055ed
Compare
std::map<uint64_t, std::vector<AdsHistory>> ads_history; | ||
base::Time now = base::Time::Now().LocalMidnight(); | ||
|
||
auto ad_history_details = client_->GetAdsShownHistory(); | ||
|
||
std::unique_ptr<AdHistoryFilter> ad_history_filter; | ||
switch (AdsHistoryFilterType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please raise an issue to refactor to use factories
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do - yep 👍
51055ed
to
8d7c067
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM++
macOS failed to build, restarting macOS. All other platforms passed |
Fixes brave/brave-browser#6205
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
As per brave/brave-browser#6205
Reviewer Checklist:
After-merge Checklist:
changes has landed on.