mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-02 12:15:55 +00:00
Various code cleanup.
This commit is contained in:
@@ -108,6 +108,19 @@ class PiggyBank extends Model
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getSuggestedMonthlyAmount()
|
||||
{
|
||||
if ($this->targetdate && $this->currentRelevantRep()->currentamount < $this->targetamount) {
|
||||
$thisMonth = Carbon::now()->month;
|
||||
$targetMonth = $this->targetdate->month;
|
||||
$remainingAmount = $this->targetamount - $this->currentRelevantRep()->currentamount;
|
||||
|
||||
return $thisMonth < $targetMonth ? $remainingAmount / ($targetMonth - $thisMonth) : $remainingAmount;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Carbon $date
|
||||
@@ -129,17 +142,6 @@ class PiggyBank extends Model
|
||||
|
||||
}
|
||||
|
||||
public function getSuggestedMonthlyAmount()
|
||||
{
|
||||
if ($this->targetdate && $this->currentRelevantRep()->currentamount < $this->targetamount) {
|
||||
$thisMonth = Carbon::now()->month;
|
||||
$targetMonth = $this->targetdate->month;
|
||||
$remainingAmount = $this->targetamount - $this->currentRelevantRep()->currentamount;
|
||||
return $thisMonth < $targetMonth ? $remainingAmount / ($targetMonth - $thisMonth) : $remainingAmount ;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the piggy bank's notes.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user