From 59151e346f15091187bd84e4243314d77d6e1fdd Mon Sep 17 00:00:00 2001 From: KMKoushik Date: Wed, 27 Mar 2024 17:39:02 +1100 Subject: [PATCH] Fix numbers not correctly showing in activity and settel up expense page --- src/components/Friend/Settleup.tsx | 10 ++++++++-- src/pages/activity.tsx | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/Friend/Settleup.tsx b/src/components/Friend/Settleup.tsx index 96ccd62..b37c74f 100644 --- a/src/components/Friend/Settleup.tsx +++ b/src/components/Friend/Settleup.tsx @@ -45,8 +45,14 @@ export const SettleUp: React.FC<{ amount: parseFloat(amount), splitType: SplitType.SETTLEMENT, participants: [ - { userId: currentUser.id, amount: isCurrentUserPaying ? 0 : -parseFloat(amount) }, - { userId: friend.id, amount: isCurrentUserPaying ? -parseFloat(amount) : 0 }, + { + userId: currentUser.id, + amount: isCurrentUserPaying ? parseFloat(amount) : -parseFloat(amount), + }, + { + userId: friend.id, + amount: isCurrentUserPaying ? -parseFloat(amount) : parseFloat(amount), + }, ], paidBy: isCurrentUserPaying ? currentUser.id : friend.id, category: 'general', diff --git a/src/pages/activity.tsx b/src/pages/activity.tsx index 78b6305..8680cda 100644 --- a/src/pages/activity.tsx +++ b/src/pages/activity.tsx @@ -33,8 +33,8 @@ function getPaymentString( return (
{user.id === paidBy - ? `You paid ${currency} - ${toUIString(amount - Math.abs(expenseUserAmt))}` + ? `You lent ${currency} + ${toUIString(Math.abs(expenseUserAmt))}` : `You owe ${currency} ${toUIString(expenseUserAmt)}`}
);