Skip to content

Commit

Permalink
refs #310 compute balances with past bills only
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Oct 20, 2024
1 parent 21e4a4d commit 2708876
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/Service/LocalProjectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ public function getProjectInfo(string $projectId): array {
$activeMembers[] = $member;
}
}
$balance = $this->getBalance($dbProjectId);
// compute balances for past bills only
$balance = $this->getBalance($dbProjectId, time());
$currencies = $this->getCurrencies($dbProjectId);
$categories = $this->getCategoriesOrPaymentModes($dbProjectId);
$paymentModes = $this->getCategoriesOrPaymentModes($dbProjectId, false);
Expand Down
2 changes: 1 addition & 1 deletion src/Settlement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
</NcEmptyContent>

<h3>
{{ maxTs ? t('cospend', 'Balances on {date}', { date: formattedMaxDate }) : t('cospend', 'Balances') }}
{{ maxTs ? t('cospend', 'Balances on {date}', { date: formattedMaxDate }) : t('cospend', 'Global balances') }}
</h3>
<NcLoadingIcon v-if="loading" :size="24" />
<v-table v-else-if="balances"
Expand Down
2 changes: 1 addition & 1 deletion src/components/CospendNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
:invitations="pendingInvitations"
@close="showPendingInvitations = false" />
<NcAppNavigationItem v-if="!pageIsPublic && showMyBalance && myBalance !== null"
:name="t('cospend', 'My balance')">
:name="t('cospend', 'My cumulated balance')">
<template #icon>
<ColoredAvatar :user="currentUserId" />
</template>
Expand Down
8 changes: 5 additions & 3 deletions src/components/statistics/Statistics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@
sort-key="filtered_balance">
{{ t('cospend', 'Filtered balance') }}
</v-th>
<v-th sort-key="balance">
{{ t('cospend', 'Balance') }}
<v-th sort-key="balance"
:title="t('cospend', 'This balance is computed from the complete bill list')">
{{ t('cospend', 'Global Balance') }}
</v-th>
</thead>
<tbody slot="body" slot-scope="{displayData}">
Expand Down Expand Up @@ -198,7 +199,8 @@
{{ selectedCurrencyName }}
</td>
<td :class="getBalanceClass(value.balance)"
:style="'border: 2px solid #' + myGetMemberColor(value.member.id) +';'">
:style="'border: 2px solid #' + myGetMemberColor(value.member.id) +';'"
:title="t('cospend', 'This balance is computed from the complete bill list')">
{{ value.balance.toFixed(2) }}
{{ selectedCurrencyName }}
</td>
Expand Down

0 comments on commit 2708876

Please sign in to comment.