File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,18 +91,18 @@ const AddPage: NextPageWithUser<{
9191 }
9292
9393 expenseQuery . data . group && setGroup ( expenseQuery . data . group ) ;
94+ setPaidBy ( expenseQuery . data . paidByUser ) ;
95+ setCurrency ( expenseQuery . data . currency as CurrencyCode ) ;
96+ setAmountStr ( ( Number ( expenseQuery . data . amount ) / 100 ) . toString ( ) ) ;
97+ setDescription ( expenseQuery . data . name ) ;
98+ setAmount ( expenseQuery . data . amount ) ;
9499 setParticipants (
95100 expenseQuery . data . expenseParticipants . map ( ( ep ) => ( {
96101 ...ep . user ,
97102 amount : ep . amount ,
98103 } ) ) ,
99104 expenseQuery . data . splitType ,
100105 ) ;
101- setCurrency ( expenseQuery . data . currency as CurrencyCode ) ;
102- setAmountStr ( ( Number ( expenseQuery . data . amount ) / 100 ) . toString ( ) ) ;
103- setDescription ( expenseQuery . data . name ) ;
104- setPaidBy ( expenseQuery . data . paidByUser ) ;
105- setAmount ( expenseQuery . data . amount ) ;
106106 useAddExpenseStore . setState ( { showFriends : false } ) ;
107107 setExpenseDate ( expenseQuery . data . expenseDate ) ;
108108 // eslint-disable-next-line react-hooks/exhaustive-deps
Original file line number Diff line number Diff line change @@ -389,7 +389,7 @@ export function calculateSplitShareBasedOnAmount(
389389 Math . round (
390390 ( Math . abs (
391391 paidBy ?. id !== p . id
392- ? Number ( p . amount ) ?? 0
392+ ? ( Number ( p . amount ) ?? 0 )
393393 : amountNum - ( Number ( p . amount ) ?? 0 ) ,
394394 ) /
395395 amountNum ) *
@@ -403,7 +403,9 @@ export function calculateSplitShareBasedOnAmount(
403403 case SplitType . EXACT :
404404 participants . forEach ( ( p ) => {
405405 splitShares [ p . id ] ! [ splitType ] =
406- paidBy ?. id !== p . id ? BigMath . abs ( p . amount ?? 0n ) : amount - BigMath . abs ( p . amount ?? 0n ) ;
406+ paidBy ?. id !== p . id
407+ ? BigMath . abs ( p . amount ?? 0n )
408+ : BigMath . abs ( amount - ( p . amount ?? 0n ) ) ;
407409 } ) ;
408410
409411 break ;
You can’t perform that action at this time.
0 commit comments