mirror of
https://github.com/spliit-app/spliit.git
synced 2026-02-18 21:46:13 +01:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
552953151a |
@@ -5,7 +5,7 @@ export function getTotalGroupSpending(
|
|||||||
): number {
|
): number {
|
||||||
return expenses.reduce(
|
return expenses.reduce(
|
||||||
(total, expense) =>
|
(total, expense) =>
|
||||||
!expense.isReimbursement ? total + expense.amount : total + 0,
|
expense.isReimbursement ? total : total + expense.amount,
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,9 @@ export function getTotalActiveUserPaidFor(
|
|||||||
): number {
|
): number {
|
||||||
return expenses.reduce(
|
return expenses.reduce(
|
||||||
(total, expense) =>
|
(total, expense) =>
|
||||||
expense.paidBy.id === activeUserId ? total + expense.amount : total + 0,
|
expense.paidBy.id === activeUserId && !expense.isReimbursement
|
||||||
|
? total + expense.amount
|
||||||
|
: total,
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -28,6 +30,8 @@ export function getTotalActiveUserShare(
|
|||||||
let total = 0
|
let total = 0
|
||||||
|
|
||||||
expenses.forEach((expense) => {
|
expenses.forEach((expense) => {
|
||||||
|
if (expense.isReimbursement) return
|
||||||
|
|
||||||
const paidFors = expense.paidFor
|
const paidFors = expense.paidFor
|
||||||
const userPaidFor = paidFors.find(
|
const userPaidFor = paidFors.find(
|
||||||
(paidFor) => paidFor.participantId === activeUserId,
|
(paidFor) => paidFor.participantId === activeUserId,
|
||||||
|
|||||||
Reference in New Issue
Block a user