mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 02:26:58 +00:00
Removed method that was already there under another name.
This commit is contained in:
@@ -226,7 +226,7 @@ class AccountController extends Controller
|
|||||||
|
|
||||||
// grouped other months thing:
|
// grouped other months thing:
|
||||||
// oldest transaction in account:
|
// oldest transaction in account:
|
||||||
$start = $repository->firstUseDate($account);
|
$start = $repository->oldestJournalDate($account);
|
||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
$start = Navigation::startOfPeriod($start, $range);
|
$start = Navigation::startOfPeriod($start, $range);
|
||||||
$end = Navigation::endOfX(new Carbon, $range);
|
$end = Navigation::endOfX(new Carbon, $range);
|
||||||
|
@@ -85,30 +85,6 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
return true;
|
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
|
* 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
|
public function oldestJournalDate(Account $account): Carbon
|
||||||
{
|
{
|
||||||
/** @var TransactionJournal $journal */
|
$first = new Carbon;
|
||||||
$journal = TransactionJournal::
|
|
||||||
leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
/** @var Transaction $first */
|
||||||
->where('transactions.account_id', $account->id)
|
$date = $account->transactions()
|
||||||
->orderBy('transaction_journals.date', 'ASC')
|
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||||
->orderBy('transaction_journals.order', 'DESC')
|
->orderBy('transaction_journals.date', 'ASC')
|
||||||
->orderBy('transaction_journals.id', 'ÅSC')
|
->orderBy('transaction_journals.order', 'DESC')
|
||||||
->first(['transaction_journals.*']);
|
->orderBy('transaction_journals.id', 'ASC')
|
||||||
if (is_null($journal)) {
|
->first(['transaction_journals.date']);
|
||||||
return new Carbon('1900-01-01');
|
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;
|
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
|
* 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,
|
* two transactions, this will return one of the two. This method fails horribly when the journal has more than two transactions,
|
||||||
|
Reference in New Issue
Block a user