mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Removed method that was already there under another name.
This commit is contained in:
parent
39ea9e85a7
commit
a8a014189d
@ -226,7 +226,7 @@ class AccountController extends Controller
|
||||
|
||||
// grouped other months thing:
|
||||
// oldest transaction in account:
|
||||
$start = $repository->firstUseDate($account);
|
||||
$start = $repository->oldestJournalDate($account);
|
||||
$range = Preferences::get('viewRange', '1M')->data;
|
||||
$start = Navigation::startOfPeriod($start, $range);
|
||||
$end = Navigation::endOfX(new Carbon, $range);
|
||||
|
@ -85,30 +85,6 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the date of the first time the Account has been used, or today if it has never been used.
|
||||
*
|
||||
* @param Account $account
|
||||
*
|
||||
* @return Carbon
|
||||
*/
|
||||
public function firstUseDate(Account $account): Carbon
|
||||
{
|
||||
$first = new Carbon;
|
||||
|
||||
/** @var Transaction $first */
|
||||
$date = $account->transactions()
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->orderBy('transaction_journals.date', 'ASC')
|
||||
->orderBy('transaction_journals.order', 'DESC')
|
||||
->orderBy('transaction_journals.id', 'ASC')
|
||||
->first(['transaction_journals.date']);
|
||||
if (!is_null($date)) {
|
||||
$first = new Carbon($date->date);
|
||||
}
|
||||
|
||||
return $first;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the transaction from a journal that is related to a given account. Since a journal generally only contains
|
||||
@ -340,19 +316,20 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
*/
|
||||
public function oldestJournalDate(Account $account): Carbon
|
||||
{
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = TransactionJournal::
|
||||
leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('transactions.account_id', $account->id)
|
||||
->orderBy('transaction_journals.date', 'ASC')
|
||||
->orderBy('transaction_journals.order', 'DESC')
|
||||
->orderBy('transaction_journals.id', 'ÅSC')
|
||||
->first(['transaction_journals.*']);
|
||||
if (is_null($journal)) {
|
||||
return new Carbon('1900-01-01');
|
||||
$first = new Carbon;
|
||||
|
||||
/** @var Transaction $first */
|
||||
$date = $account->transactions()
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->orderBy('transaction_journals.date', 'ASC')
|
||||
->orderBy('transaction_journals.order', 'DESC')
|
||||
->orderBy('transaction_journals.id', 'ASC')
|
||||
->first(['transaction_journals.date']);
|
||||
if (!is_null($date)) {
|
||||
$first = new Carbon($date->date);
|
||||
}
|
||||
|
||||
return $journal->date;
|
||||
return $first;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,15 +47,6 @@ interface AccountRepositoryInterface
|
||||
*/
|
||||
public function destroy(Account $account, Account $moveTo): bool;
|
||||
|
||||
/**
|
||||
* Returns the date of the first time the Account has been used, or today if it has never been used.
|
||||
*
|
||||
* @param Account $account
|
||||
*
|
||||
* @return Carbon
|
||||
*/
|
||||
public function firstUseDate(Account $account): Carbon;
|
||||
|
||||
/**
|
||||
* Returns the transaction from a journal that is related to a given account. Since a journal generally only contains
|
||||
* two transactions, this will return one of the two. This method fails horribly when the journal has more than two transactions,
|
||||
|
Loading…
Reference in New Issue
Block a user