fix stupid variable names

This commit is contained in:
Bence Pőcze 2023-05-01 23:02:57 +02:00
parent 4dbbb1321c
commit b5dc96f98b
Signed by: bence
GPG Key ID: DC5BD6E95A333E6D
2 changed files with 12 additions and 12 deletions

View File

@ -53,18 +53,18 @@ class CommunityController implements IAuthenticationRequired
$balanceCalculator = new BalanceCalculator($community);
$debts = $balanceCalculator->calculate();
$debtUsers = [];
$debtItems = [];
$debtBalance = 0.0;
$outstandingUsers = [];
$outstandingItems = [];
$outstandingBalance = 0.0;
foreach ($debts as $debt) {
if ($debt['payer']->getId() === \Container::$request->user()->getUniqueId()) {
$debtBalance += $debt['amount'];
$debtUsers[] = $debt;
$debtItems[] = $debt;
}
if ($debt['payee']->getId() === \Container::$request->user()->getUniqueId()) {
$outstandingBalance += $debt['amount'];
$outstandingUsers[] = $debt;
$outstandingItems[] = $debt;
}
}
$balance = $outstandingBalance - $debtBalance;
@ -74,9 +74,9 @@ class CommunityController implements IAuthenticationRequired
'members' => $this->getMembers($community),
'currencies' => $this->getCurrencies($community),
'upcomingEvents' => [],
'debtUsers' => $debtUsers,
'debtItems' => $debtItems,
'debtBalance' => $debtBalance,
'outstandingUsers' => $outstandingUsers,
'outstandingItems' => $outstandingItems,
'outstandingBalance' => $outstandingBalance,
'balance' => $balance,
'editPermission' => $ownCommunityMember->getOwner()

View File

@ -52,20 +52,20 @@
<td class="bold">You owe</td>
<td class="mono red" style="text-align: right;"><?= number_format($debtBalance, $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
</tr>
<?php foreach ($debtUsers as $owe): ?>
<?php foreach ($debtItems as $item): ?>
<tr>
<td class="small"><?= $owe['payee']->getUser()->getDisplayName() ?></td>
<td class="small mono red" style="text-align: right;"><?= number_format($owe['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
<td class="small"><?= $item['payee']->getUser()->getDisplayName() ?></td>
<td class="small mono red" style="text-align: right;"><?= number_format($item['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
</tr>
<?php endforeach; ?>
<tr>
<td class="bold">You're owed</td>
<td class="mono green" style="text-align: right;"><?= number_format($outstandingBalance, $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
</tr>
<?php foreach ($outstandingUsers as $owe): ?>
<?php foreach ($outstandingItems as $item): ?>
<tr>
<td class="small"><?= $owe['payer']->getUser()->getDisplayName() ?></td>
<td class="small mono green" style="text-align: right;"><?= number_format($owe['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
<td class="small"><?= $item['payer']->getUser()->getDisplayName() ?></td>
<td class="small mono green" style="text-align: right;"><?= number_format($item['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
</tr>
<?php endforeach; ?>
<tr>