mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Expand test coverage and improve transaction management code.
This commit is contained in:
@@ -303,13 +303,11 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO check usage and verify it still works.
|
||||
*
|
||||
* @param Recurrence $recurrence
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getTransactions(Recurrence $recurrence): array
|
||||
public function getTransactions(Recurrence $recurrence): Collection
|
||||
{
|
||||
$journalMeta = TransactionJournalMeta
|
||||
::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id')
|
||||
@@ -319,9 +317,17 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
->where('data', json_encode((string)$recurrence->id))
|
||||
->get()->pluck('transaction_journal_id')->toArray();
|
||||
$search = [];
|
||||
|
||||
|
||||
|
||||
foreach ($journalMeta as $journalId) {
|
||||
$search[] = (int)$journalId;
|
||||
}
|
||||
if (0 === count($search)) {
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
|
||||
@@ -330,7 +336,7 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
// filter on specific journals.
|
||||
$collector->setJournalIds($search);
|
||||
|
||||
return $collector->getExtractedJournals();
|
||||
return $collector->getGroups();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -141,9 +141,9 @@ interface RecurringRepositoryInterface
|
||||
/**
|
||||
* @param Recurrence $recurrence
|
||||
*
|
||||
* @return array
|
||||
* @return Collection
|
||||
*/
|
||||
public function getTransactions(Recurrence $recurrence): array;
|
||||
public function getTransactions(Recurrence $recurrence): Collection;
|
||||
|
||||
/**
|
||||
* Calculate the next X iterations starting on the date given in $date.
|
||||
|
Reference in New Issue
Block a user