Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix generatePerformanceBountyName

Steven Tey022bd9a3e2db
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty-sheet.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty-sheet.tsx
index 2cc62a5661..92f78c619e 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty-sheet.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty-sheet.tsx
@@ -407,7 +407,14 @@ function BountySheetContent({ setIsOpen, bounty }: BountySheetProps) {
type === "performance" && performanceCondition
? generatePerformanceBountyName({
rewardAmount: rewardAmount ? rewardAmount * 100 : 0,
- condition: performanceCondition,
+ condition: isCurrencyAttribute(
+ performanceCondition?.attribute,
+ )
+ ? {
+ ...performanceCondition,
+ value: performanceCondition?.value * 100,
+ }
+ : performanceCondition,
})
: name || "New bounty",
startsAt: startsAt || new Date(),
diff --git a/apps/web/lib/api/bounties/generate-performance-bounty-name.ts b/apps/web/lib/api/bounties/generate-performance-bounty-name.ts
index 9e011ef245..35ddaac95a 100644
--- a/apps/web/lib/api/bounties/generate-performance-bounty-name.ts
+++ b/apps/web/lib/api/bounties/generate-performance-bounty-name.ts
@@ -13,9 +13,8 @@ export const generatePerformanceBountyName = ({
const isCurrency = isCurrencyAttribute(condition.attribute);
const attributeLabel =
PERFORMANCE_BOUNTY_SCOPE_ATTRIBUTES[condition.attribute];
- // Format the value to be in cents if it's a currency attribute
const valueFormatted = isCurrency
- ? `${currencyFormatter(condition.value * 100, { trailingZeroDisplay: "stripIfInteger" })} in`
+ ? `${currencyFormatter(condition.value, { trailingZeroDisplay: "stripIfInteger" })} in`
: `${nFormatter(condition.value, { full: true })}`;
return `Earn ${currencyFormatter(rewardAmount, { trailingZeroDisplay: "stripIfInteger" })} after generating ${valueFormatted} ${attributeLabel.toLowerCase()}`;