Skip to content

Commit

Permalink
fix: make frequency caps the same (#959)
Browse files Browse the repository at this point in the history
* fix: make frequency caps the same

* fix: tests
  • Loading branch information
IanKrieger authored Oct 26, 2023
1 parent 150cd58 commit 269c989
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/user/library/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ describe("new form tests", () => {
"budget": 1000,
"currency": "USD",
"dailyBudget": 10,
"dailyCap": 1,
"dailyCap": 4,
"externalId": "",
"format": "PUSH_NOTIFICATION",
"geoTargets": [
Expand Down
8 changes: 6 additions & 2 deletions src/user/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function transformNewForm(
return {
currency: form.currency,
externalId: "",
dailyCap: form.format === CampaignFormat.NewsDisplayAd ? 4 : 1,
dailyCap: dailyLimit(form.format),
dailyBudget: form.dailyBudget,
endAt: form.endAt,
pacingStrategy: CampaignPacingStrategies.ModelV1,
Expand Down Expand Up @@ -242,13 +242,17 @@ function transformAdSet(
name: adSet.name,
price: transformPrice(campaign),
billingType: campaign.billingType,
perDay: campaign.format === CampaignFormat.PushNotification ? 4 : 6,
perDay: dailyLimit(campaign.format),
segments: adSet.segments.map((s) => ({ code: s.code, name: s.name })),
oses: adSet.oses.map((s) => ({ code: s.code, name: s.name })),
totalMax: campaign.format === CampaignFormat.PushNotification ? 28 : 60,
};
}

function dailyLimit(format: CampaignFormat) {
return format === CampaignFormat.NewsDisplayAd ? 6 : 4;
}

export function uiTextForCreativeType(creativeType: string): string {
return TYPE_CODE_LOOKUP[creativeType] ?? creativeType;
}
Expand Down

0 comments on commit 269c989

Please sign in to comment.