Rename various methods.

This commit is contained in:
James Cole
2018-08-11 19:21:58 +02:00
parent 95ce72fce7
commit a35c6e29b6
15 changed files with 79 additions and 36 deletions

View File

@@ -138,12 +138,12 @@ class PopupReport implements PopupReportInterface
$collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])
->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER]);
$journals = $collector->getTransactions();
$transactions = $collector->getTransactions();
$report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report
// filter for transfers and withdrawals TO the given $account
$journals = $journals->filter(
$transactions = $transactions->filter(
function (Transaction $transaction) use ($report, $repository) {
// get the destinations:
$sources = $repository->getJournalSourceAccounts($transaction->transactionJournal)->pluck('id')->toArray();
@@ -153,7 +153,7 @@ class PopupReport implements PopupReportInterface
}
);
return $journals;
return $transactions;
}
/**
@@ -173,11 +173,11 @@ class PopupReport implements PopupReportInterface
$collector = app(TransactionCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])
->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER]);
$journals = $collector->getTransactions();
$transactions = $collector->getTransactions();
$report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report
// filter the set so the destinations outside of $attributes['accounts'] are not included.
$journals = $journals->filter(
$transactions = $transactions->filter(
function (Transaction $transaction) use ($report, $repository) {
// get the destinations:
$journal = $transaction->transactionJournal;
@@ -188,6 +188,6 @@ class PopupReport implements PopupReportInterface
}
);
return $journals;
return $transactions;
}
}

View File

@@ -86,7 +86,7 @@ class ReportHelper implements ReportHelperInterface
/** @var TransactionCollectorInterface $collector */
$collector = app(TransactionCollectorInterface::class);
$collector->setAccounts($accounts)->setRange($payDate, $endOfPayPeriod)->setBills($bills);
$journals = $collector->getTransactions();
$transactions = $collector->getTransactions();
$billLine = new BillLine;
$billLine->setBill($bill);
@@ -95,7 +95,7 @@ class ReportHelper implements ReportHelperInterface
$billLine->setMin((string)$bill->amount_min);
$billLine->setMax((string)$bill->amount_max);
$billLine->setHit(false);
$entry = $journals->filter(
$entry = $transactions->filter(
function (Transaction $transaction) use ($bill) {
return $transaction->bill_id === $bill->id;
}