mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 18:40:12 +00:00
Removed unused method.
This commit is contained in:
@@ -147,11 +147,9 @@ class CategoryController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CRI $repository
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function noCategory(CRI $repository)
|
||||
public function noCategory()
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$start = session('start', Carbon::now()->startOfMonth());
|
||||
@@ -162,14 +160,11 @@ class CategoryController extends Controller
|
||||
$collector = new JournalCollector(auth()->user());
|
||||
$collector->setAllAssetAccounts()->setRange($start, $end)->withoutCategory();//->groupJournals();
|
||||
$journals = $collector->getJournals();
|
||||
// $list = $repository->journalsInPeriodWithoutCategory(new Collection(), [], $start, $end); // category
|
||||
$subTitle = trans(
|
||||
'firefly.without_category_between',
|
||||
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||
);
|
||||
|
||||
|
||||
|
||||
return view('categories.no-category', compact('journals', 'subTitle'));
|
||||
}
|
||||
|
||||
|
@@ -174,67 +174,6 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param array $types
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function journalsInPeriodWithoutCategory(Collection $accounts, array $types, Carbon $start, Carbon $end) : Collection
|
||||
{
|
||||
/** @var Collection $set */
|
||||
$query = $this->user
|
||||
->transactionJournals();
|
||||
if (count($types) > 0) {
|
||||
$query->transactionTypes($types);
|
||||
}
|
||||
|
||||
$query->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->whereNull('category_transaction_journal.id')
|
||||
->before($end)
|
||||
->after($start);
|
||||
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$query->leftJoin('transactions as t', 't.transaction_journal_id', '=', 'transaction_journals.id');
|
||||
$query->whereIn('t.account_id', $accountIds);
|
||||
}
|
||||
|
||||
$set = $query->get(['transaction_journals.*']);
|
||||
|
||||
if ($set->count() == 0) {
|
||||
return new Collection;
|
||||
}
|
||||
|
||||
// grab all the transactions from this set.
|
||||
// take only the journals with transactions that all have no category.
|
||||
// select transactions left join journals where id in this set
|
||||
// and left join transaction-category where null category
|
||||
$journalIds = $set->pluck('id')->toArray();
|
||||
$secondQuery = $this->user->transactions()
|
||||
->leftJoin('category_transaction', 'category_transaction.transaction_id', '=', 'transactions.id')
|
||||
->whereNull('category_transaction.id')
|
||||
->whereIn('transaction_journals.id', $journalIds);
|
||||
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$secondQuery->whereIn('transactions.account_id', $accountIds);
|
||||
}
|
||||
|
||||
// this second set REALLY doesn't have any categories.
|
||||
$secondSet = $secondQuery->get(['transactions.transaction_journal_id']);
|
||||
$allIds = $secondSet->pluck('transaction_journal_id')->toArray();
|
||||
$return = $this->user->transactionJournals()->sortCorrectly()->expanded()->whereIn('transaction_journals.id', $allIds)->get(
|
||||
TransactionJournal::queryFields()
|
||||
);
|
||||
|
||||
return $return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
* @param Collection $accounts
|
||||
|
@@ -84,16 +84,6 @@ interface CategoryRepositoryInterface
|
||||
*/
|
||||
public function getCategories(): Collection;
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param array $types
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function journalsInPeriodWithoutCategory(Collection $accounts, array $types, Carbon $start, Carbon $end) : Collection;
|
||||
|
||||
/**
|
||||
* Return most recent transaction(journal) date.
|
||||
*
|
||||
|
Reference in New Issue
Block a user