mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Small php fixes.
This commit is contained in:
@@ -70,7 +70,7 @@ class Calculator
|
||||
}
|
||||
self::$intervalMap = new SplObjectStorage();
|
||||
foreach (Periodicity::cases() as $interval) {
|
||||
$periodicityClass = __NAMESPACE__."\\Periodicity\\{$interval->name}";
|
||||
$periodicityClass = sprintf('%s\\Periodicity\\%s',__NAMESPACE__,$interval->name);
|
||||
self::$intervals[] = $interval->name;
|
||||
self::$intervalMap->attach($interval, new $periodicityClass());
|
||||
}
|
||||
|
@@ -47,7 +47,6 @@ class BudgetLimitEnrichment implements EnrichmentInterface
|
||||
private array $notes = [];
|
||||
private Carbon $start;
|
||||
private Carbon $end;
|
||||
private Collection $budgets;
|
||||
private array $expenses = [];
|
||||
private array $pcExpenses = [];
|
||||
private array $currencyIds = [];
|
||||
@@ -147,11 +146,11 @@ class BudgetLimitEnrichment implements EnrichmentInterface
|
||||
private function collectBudgets(): void
|
||||
{
|
||||
$budgetIds = $this->collection->pluck('budget_id')->unique()->toArray();
|
||||
$this->budgets = Budget::whereIn('id', $budgetIds)->get();
|
||||
$budgets = Budget::whereIn('id', $budgetIds)->get();
|
||||
|
||||
$repository = app(OperationsRepository::class);
|
||||
$repository->setUser($this->user);
|
||||
$expenses = $repository->collectExpenses($this->start, $this->end, null, $this->budgets, null);
|
||||
$expenses = $repository->collectExpenses($this->start, $this->end, null, $budgets, null);
|
||||
|
||||
/** @var BudgetLimit $budgetLimit */
|
||||
foreach ($this->collection as $budgetLimit) {
|
||||
|
@@ -206,7 +206,7 @@ class AccountBalanceCalculator
|
||||
foreach ($transactionJournal->transactions as $transaction) {
|
||||
$set[$transaction->account_id] = $transaction->account;
|
||||
}
|
||||
$accounts = new Collection($set);
|
||||
$accounts = new Collection()->push(...$set);
|
||||
$object->optimizedCalculation($accounts, $transactionJournal->date);
|
||||
}
|
||||
}
|
||||
|
@@ -79,14 +79,13 @@ trait FiltersWeekends
|
||||
);
|
||||
$return[] = $clone;
|
||||
|
||||
continue;
|
||||
}
|
||||
// Log::debug(sprintf('Date is %s, removed from final result', $date->format('D d M Y')));
|
||||
}
|
||||
|
||||
// filter unique dates
|
||||
Log::debug(sprintf('Count before filtering: %d', count($dates)));
|
||||
$collection = new Collection($return);
|
||||
$collection = new Collection()->push(...$return);
|
||||
$filtered = $collection->unique();
|
||||
$return = $filtered->toArray();
|
||||
|
||||
|
Reference in New Issue
Block a user