mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
Refactor method that only counts.
This commit is contained in:
@@ -145,9 +145,9 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
* @param Carbon|null $start
|
||||
* @param Carbon|null $end
|
||||
*
|
||||
* @return Collection
|
||||
* @return int
|
||||
*/
|
||||
public function getJournals(Recurrence $recurrence, Carbon $start = null, Carbon $end = null): Collection
|
||||
public function getJournalCount(Recurrence $recurrence, Carbon $start = null, Carbon $end = null): int
|
||||
{
|
||||
$query = TransactionJournal
|
||||
::leftJoin('journal_meta', 'journal_meta.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
@@ -162,7 +162,7 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
$query->where('transaction_journals.date', '<=', $end->format('Y-m-d 00:00:00'));
|
||||
}
|
||||
|
||||
return $query->get(['transaction_journals.*']);
|
||||
return $query->get(['transaction_journals.*'])->count();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -79,15 +79,15 @@ interface RecurringRepositoryInterface
|
||||
public function getCategory(RecurrenceTransaction $recTransaction): ?string;
|
||||
|
||||
/**
|
||||
* Returns the journals created for this recurrence, possibly limited by time.
|
||||
* Returns the count of journals created for this recurrence, possibly limited by time.
|
||||
*
|
||||
* @param Recurrence $recurrence
|
||||
* @param Carbon|null $start
|
||||
* @param Carbon|null $end
|
||||
*
|
||||
* @return Collection
|
||||
* @return int
|
||||
*/
|
||||
public function getJournals(Recurrence $recurrence, Carbon $start = null, Carbon $end = null): Collection;
|
||||
public function getJournalCount(Recurrence $recurrence, Carbon $start = null, Carbon $end = null): int;
|
||||
|
||||
/**
|
||||
* Get the notes.
|
||||
|
Reference in New Issue
Block a user