diff --git a/app/Models/UserGroup.php b/app/Models/UserGroup.php index 2852213961..0a8f3cc909 100644 --- a/app/Models/UserGroup.php +++ b/app/Models/UserGroup.php @@ -49,6 +49,8 @@ use Illuminate\Support\Carbon; * @method static Builder|UserGroup whereId($value) * @method static Builder|UserGroup whereTitle($value) * @method static Builder|UserGroup whereUpdatedAt($value) + * @property-read Collection $accounts + * @property-read int|null $accounts_count * @mixin Eloquent */ class UserGroup extends Model diff --git a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php index 87490823b0..3848cad1b1 100644 --- a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php +++ b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php @@ -178,7 +178,7 @@ trait ModifiesPiggyBanks return $piggyBank; } $max = $piggyBank->targetamount; - if (1 === bccomp($amount, $max)) { + if (1 === bccomp($amount, $max) && 0 !== bccomp($piggyBank->targetamount, '0')) { $amount = $max; } $difference = bcsub($amount, $repetition->currentamount);