mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
New budget repository tests.
This commit is contained in:
@@ -25,21 +25,6 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
*/
|
||||
public function cleanupBudgets()
|
||||
{
|
||||
$limits = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')->get(['budget_limits.*']);
|
||||
|
||||
// loop budget limits:
|
||||
$found = [];
|
||||
/** @var BudgetLimit $limit */
|
||||
foreach ($limits as $limit) {
|
||||
$key = $limit->budget_id . '-' . $limit->startdate;
|
||||
if (isset($found[$key])) {
|
||||
$limit->delete();
|
||||
} else {
|
||||
$found[$key] = true;
|
||||
}
|
||||
unset($key);
|
||||
}
|
||||
|
||||
// delete limits with amount 0:
|
||||
BudgetLimit::where('amount', 0)->delete();
|
||||
|
||||
|
Reference in New Issue
Block a user