From b54b4d3604f32c976c827516308d173bebc09d92 Mon Sep 17 00:00:00 2001 From: Michael Canova Date: Mon, 9 Feb 2026 13:08:53 -0500 Subject: [PATCH 1/2] [Bounty] Non Foundation Bounty Amount Fix --- components/Bounty/lib/bountyUtil.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/components/Bounty/lib/bountyUtil.ts b/components/Bounty/lib/bountyUtil.ts index d5cafce2..cec9ed4e 100644 --- a/components/Bounty/lib/bountyUtil.ts +++ b/components/Bounty/lib/bountyUtil.ts @@ -529,6 +529,18 @@ export const isFoundationBounty = (bounty: Bounty): boolean => { return creatorUserId === FOUNDATION_USER_ID; }; +/** + * Gets the RSC amount from a bounty, preferring totalAmount if it's greater than 0. + * This handles the case where totalAmount might be '0' due to ignoreBaseAmount transformation. + * + * @param bounty The bounty to get the amount from + * @returns The RSC amount as a number + */ +const getRscAmount = (bounty: Bounty): number => { + const totalAmount = parseFloat(bounty.totalAmount || '0'); + return totalAmount > 0 ? totalAmount : parseFloat(bounty.amount || '0'); +}; + /** * Calculates the display amount for a bounty in USD. * For Foundation bounties, returns a flat $150 USD. @@ -543,7 +555,7 @@ export const calculateBountyDisplayAmountUSD = (bounty: Bounty, exchangeRate: nu return FOUNDATION_BOUNTY_FLAT_USD; } - const rscAmount = parseFloat(bounty.totalAmount || bounty.amount || '0'); + const rscAmount = getRscAmount(bounty); return Math.round(rscAmount * exchangeRate); }; @@ -571,7 +583,7 @@ export const getBountyDisplayAmount = ( showUSD: boolean ): { amount: number; isFoundation: boolean } => { const isFoundation = isFoundationBounty(bounty); - const rscAmount = parseFloat(bounty.totalAmount || bounty.amount || '0'); + const rscAmount = getRscAmount(bounty); if (isFoundation) { if (showUSD) { From 73752e98711cf2ecfbb404a83109750118f81ae5 Mon Sep 17 00:00:00 2001 From: Michael Canova Date: Mon, 9 Feb 2026 13:31:43 -0500 Subject: [PATCH 2/2] Linter Fixes --- components/Bounty/lib/bountyUtil.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Bounty/lib/bountyUtil.ts b/components/Bounty/lib/bountyUtil.ts index cec9ed4e..d2f895a8 100644 --- a/components/Bounty/lib/bountyUtil.ts +++ b/components/Bounty/lib/bountyUtil.ts @@ -537,8 +537,8 @@ export const isFoundationBounty = (bounty: Bounty): boolean => { * @returns The RSC amount as a number */ const getRscAmount = (bounty: Bounty): number => { - const totalAmount = parseFloat(bounty.totalAmount || '0'); - return totalAmount > 0 ? totalAmount : parseFloat(bounty.amount || '0'); + const totalAmount = Number.parseFloat(bounty.totalAmount || '0'); + return totalAmount > 0 ? totalAmount : Number.parseFloat(bounty.amount || '0'); }; /**