Skip to content

Commit

Permalink
Fix equal split with one participant resetting on edit (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
WinnieTheShoe authored Jan 25, 2025
1 parent 71c561a commit b04dd36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/store/addStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export function calculateSplitShareBasedOnAmount(
// For equal split, split share should be amount/participants or 0 if amount is 0
updatedParticipants = participants.map((p) => ({
...p,
splitShare: p.amount === 0 ? 0 : 1,
splitShare: (paidBy?.id === p.id ? (p.amount ?? 0) - amount : p.amount) === 0 ? 0 : 1,
}));
break;

Expand Down

0 comments on commit b04dd36

Please sign in to comment.