perf(transactions): resolve the override handler once for bulk updates

bulkUpdate() re-resolved CategoryOverrideHandler from the container on
every iteration of the transaction loop. Resolve it once before the loop
— cheaper, and it lets the handler's AiRuleLearner memoize per-user work
across the batch (see follow-up).
This commit is contained in:
Víctor Falcón 2026-07-03 03:37:39 +02:00
parent ad46e465be
commit 7b13214e07
1 changed files with 3 additions and 1 deletions

View File

@ -313,8 +313,10 @@ class TransactionController extends Controller
if ($request->has('category_id')) {
$newCategoryId = $request->input('category_id');
$overrideHandler = app(CategoryOverrideHandler::class);
foreach ($transactions as $transaction) {
app(CategoryOverrideHandler::class)->record($transaction, $newCategoryId);
$overrideHandler->record($transaction, $newCategoryId);
}
$updateData['category_id'] = $newCategoryId;