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

getCpmInNewCurrency to use current value of bid.cpm and bid.currency #3845

Merged
merged 2 commits into from
Jun 3, 2019

Conversation

pm-harshad-mane
Copy link
Contributor

@pm-harshad-mane pm-harshad-mane commented May 21, 2019

Type of change

Description of change

bid.getCpmInNewCurrency should use the latest value of bid.cpm and bid.currency as we allow publishers to update the value of bid.cpm (using bidAdjustment and bidResponse event) hence the bid.getCpmInNewCurrency API should return the bid.cpm equivalent value in the requested currency.

#3837

@pm-harshad-mane
Copy link
Contributor Author

pm-harshad-mane commented May 21, 2019

Before the fix:
Pbjs bid response received: pbBid.cpm: 6.9657 pbBid.getCpmInNewCurrency('USD'): 0.100 pbBid.originalCurrency: USD
setting bid.cpm = bid.cpm X 100
Pbjs bid response received: pbBid.cpm: 696.57 pbBid.getCpmInNewCurrency('USD'): 0.100 pbBid.originalCurrency: USD
Pbjs bid response received: pbBid.cpm: 6.9657 pbBid.getCpmInNewCurrency('USD'): 0.100 pbBid.originalCurrency: USD
setting bid.cpm = bid.cpm X 100
Pbjs bid response received: pbBid.cpm: 696.57 pbBid.getCpmInNewCurrency('USD'): 0.100 pbBid.originalCurrency: USD

After the fix:
Pbjs bid response received: pbBid.cpm: 6.9657 pbBid.getCpmInNewCurrency('USD'): 0.100 pbBid.originalCurrency: USD
setting bid.cpm = bid.cpm X 100
Pbjs bid response received: pbBid.cpm: 696.57 pbBid.getCpmInNewCurrency('USD'): 10.031 pbBid.originalCurrency: USD
Pbjs bid response received: pbBid.cpm: 6.9657 pbBid.getCpmInNewCurrency('USD'): 0.100 pbBid.originalCurrency: USD
setting bid.cpm = bid.cpm X 100
Pbjs bid response received: pbBid.cpm: 696.57 pbBid.getCpmInNewCurrency('USD'): 10.031 pbBid.originalCurrency: USD

@pm-harshad-mane
Copy link
Contributor Author

pm-harshad-mane commented May 22, 2019

Test Page: http://jsfiddle.net/tfsercgk/

@pm-harshad-mane
Copy link
Contributor Author

Hello @jsnellbaker ,
Could you please review this PR?

@pm-harshad-mane
Copy link
Contributor Author

Hello @jsnellbaker ,
A gentle reminder :)
Could you please review the changes?

@mkendall07
Copy link
Member

hey @pm-harshad-mane
can you add a test case for this?

@pm-harshad-mane
Copy link
Contributor Author

Sure @mkendall07 , i will update as I am done.

Copy link
Collaborator

@snapwich snapwich left a comment

Choose a reason for hiding this comment

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

I think this should be fine.

@pm-harshad-mane
Copy link
Contributor Author

Hello @mkendall07 , @snapwich ,
I have added a test-case for the change, the test-case fails with the older approach.

@jsnellbaker
Copy link
Collaborator

I've been ooo for a little while, checking over this PR now.

Copy link
Collaborator

@jsnellbaker jsnellbaker left a comment

Choose a reason for hiding this comment

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

LGTM

@jsnellbaker jsnellbaker merged commit 7aa0e0d into prebid:master Jun 3, 2019
@pm-harshad-mane
Copy link
Contributor Author

Thank you @jsnellbaker , @snapwich , @mkendall07, and @mike-chowla :)

idettman pushed a commit that referenced this pull request Jul 15, 2019
* Fixing the issue introduced in #3845 for rubi analytics adapter

* using utils.deepClone instead of custom clone
leonardlabat pushed a commit to criteo-forks/Prebid.js that referenced this pull request Jul 30, 2019
…prebid#3996)

* Fixing the issue introduced in prebid#3845 for rubi analytics adapter

* using utils.deepClone instead of custom clone
VideoReach pushed a commit to VideoReach/Prebid.js that referenced this pull request Aug 1, 2019
…rebid#3845)

* getCpmInNewCurrency to use current value of bid.cpm and bid.currency

* added a test case for boosted bid, this test fails with old code
VideoReach pushed a commit to VideoReach/Prebid.js that referenced this pull request Aug 1, 2019
…prebid#3996)

* Fixing the issue introduced in prebid#3845 for rubi analytics adapter

* using utils.deepClone instead of custom clone
sa1omon pushed a commit to gamoshi/Prebid.js that referenced this pull request Nov 28, 2019
…prebid#3996)

* Fixing the issue introduced in prebid#3845 for rubi analytics adapter

* using utils.deepClone instead of custom clone
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.

None yet

4 participants