Skip to content

Commit

Permalink
Merge pull request #905 from brave/master
Browse files Browse the repository at this point in the history
Production Release 2023-09-27
  • Loading branch information
IanKrieger authored Sep 27, 2023
2 parents e9bc7cf + 3f190b5 commit 75c0b7f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
13 changes: 6 additions & 7 deletions src/form/fragmentUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,14 @@ export function createAdSetFromFragment(
data: AdSetFragment,
campaignId?: string,
): CreateAdSetInput {
const ads = (data.ads ?? []).filter((ad) => ad.state !== "deleted");

return {
campaignId,
ads: (data.ads ?? [])
.filter((ad) => ad.state !== "deleted")
.map((ad) => ({
creativeId: ad.creative.id,
price: ad.price,
priceType: ad.priceType,
})),
ads: ads.map((ad) => ({
creativeId: ad.creative.id,
})),
price: ads[0].price,
bannedKeywords: data.bannedKeywords,
billingType: data.billingType ?? "cpm",
conversions: (data.conversions ?? []).map((c) => ({
Expand Down
4 changes: 3 additions & 1 deletion src/graphql/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/user/library/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe("pricing logic (read)", () => {
c.adSets = [];
});
const formObject = editCampaignValues(campaign, "abc");
expect(formObject.price).toEqual("100");
expect(formObject.price).toEqual("6");
expect(formObject.billingType).toEqual("cpm");
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/user/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function editCampaignValues(

const billingType = (_.head(campaign.adSets)?.billingType ??
"cpm") as Billing;
const rawPrice = BigNumber(_.head(campaign.adSets)?.price ?? "0.1");
const rawPrice = BigNumber(_.head(campaign.adSets)?.price ?? ".006");
const price = billingType === "cpm" ? rawPrice.multipliedBy(1000) : rawPrice;

return {
Expand Down

0 comments on commit 75c0b7f

Please sign in to comment.