mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
Expand test coverage and improve transaction management code.
This commit is contained in:
@@ -36,7 +36,7 @@ class AccountList implements BinderInterface
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @param Route $route
|
||||
* @param Route $route
|
||||
*
|
||||
* @return Collection
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
@@ -44,25 +44,29 @@ class AccountList implements BinderInterface
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route): Collection
|
||||
{
|
||||
Log::debug(sprintf('Now in AccountList::routeBinder("%s")', $value));
|
||||
if (auth()->check()) {
|
||||
Log::debug('User is logged in.');
|
||||
$collection = new Collection;
|
||||
if ('allAssetAccounts' === $value) {
|
||||
/** @var \Illuminate\Support\Collection $collection */
|
||||
/** @var Collection $collection */
|
||||
$collection = auth()->user()->accounts()
|
||||
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||
->where('account_types.type', AccountType::ASSET)
|
||||
->orderBy('accounts.name', 'ASC')
|
||||
->get(['accounts.*']);
|
||||
Log::debug(sprintf('Collection length is %d', $collection->count()));
|
||||
}
|
||||
if ('allAssetAccounts' !== $value) {
|
||||
$incoming = array_map('\intval', explode(',', $value));
|
||||
$list = array_merge(array_unique($incoming), [0]);
|
||||
/** @var \Illuminate\Support\Collection $collection */
|
||||
/** @var Collection $collection */
|
||||
$collection = auth()->user()->accounts()
|
||||
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||
->whereIn('accounts.id', $list)
|
||||
->orderBy('accounts.name', 'ASC')
|
||||
->get(['accounts.*']);
|
||||
Log::debug(sprintf('Collection length is %d', $collection->count()));
|
||||
}
|
||||
|
||||
if ($collection->count() > 0) {
|
||||
|
Reference in New Issue
Block a user