From d9ee03a96ff1b3a7a1cab733154575c8cc422611 Mon Sep 17 00:00:00 2001 From: mantikoros Date: Wed, 27 Apr 2022 22:18:52 -0400 Subject: [PATCH] sendNewCommentEmail: handle sold shares for cfmm --- functions/src/emails.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/functions/src/emails.ts b/functions/src/emails.ts index 290aaecb..20cd002b 100644 --- a/functions/src/emails.ts +++ b/functions/src/emails.ts @@ -48,8 +48,8 @@ export const sendMarketResolutionEmail = async ( creatorName: creator.name, question: contract.question, outcome, - investment: `${Math.round(investment)}`, - payout: `${Math.round(payout)}`, + investment: `${Math.floor(investment)}`, + payout: `${Math.floor(payout)}`, url: `https://${DOMAIN}/${creator.username}/${contract.slug}`, } @@ -189,7 +189,9 @@ export const sendNewCommentEmail = async ( let betDescription = '' if (bet) { const { amount, sale } = bet - betDescription = `${sale ? 'sold' : 'bought'} M$ ${Math.round(amount)}` + betDescription = `${sale || amount < 0 ? 'sold' : 'bought'} ${formatMoney( + amount + )}` } const subject = `Comment on ${question}`