mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 17:33:45 +00:00
Fix methods
This commit is contained in:
@@ -161,24 +161,6 @@ class CorrectAmounts extends Command
|
|||||||
$this->friendlyInfo(sprintf('Corrected %d currency exchange rate(s).', $count));
|
$this->friendlyInfo(sprintf('Corrected %d currency exchange rate(s).', $count));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function fixRepetitions(): void
|
|
||||||
{
|
|
||||||
$set = PiggyBankRepetition::where('current_amount', '<', 0)->get();
|
|
||||||
$count = $set->count();
|
|
||||||
if (0 === $count) {
|
|
||||||
$this->friendlyPositive('All piggy bank repetition amounts are positive.');
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @var PiggyBankRepetition $item */
|
|
||||||
foreach ($set as $item) {
|
|
||||||
$item->current_amount = app('steam')->positive($item->current_amount);
|
|
||||||
$item->save();
|
|
||||||
}
|
|
||||||
$this->friendlyInfo(sprintf('Corrected %d piggy bank repetition amount(s).', $count));
|
|
||||||
}
|
|
||||||
|
|
||||||
private function fixPiggyBanks(): void
|
private function fixPiggyBanks(): void
|
||||||
{
|
{
|
||||||
$set = PiggyBank::where('target_amount', '<', 0)->get();
|
$set = PiggyBank::where('target_amount', '<', 0)->get();
|
||||||
|
@@ -370,7 +370,17 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
|||||||
#[\Override]
|
#[\Override]
|
||||||
public function purgeAll(): void
|
public function purgeAll(): void
|
||||||
{
|
{
|
||||||
throw new FireflyException('TODO Not implemented');
|
PiggyBank::withTrashed()
|
||||||
|
->whereNotNull('piggy_banks.deleted_at')
|
||||||
|
->leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id')
|
||||||
|
->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id')
|
||||||
|
->where('accounts.user_id', auth()->user()->id)
|
||||||
|
->with(
|
||||||
|
[
|
||||||
|
'objectGroups',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\Override]
|
#[\Override]
|
||||||
|
Reference in New Issue
Block a user