mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Restore old behavior
This commit is contained in:
		| @@ -132,7 +132,7 @@ class BudgetRepository implements BudgetRepositoryInterface | ||||
| 
 | ||||
|                     continue; | ||||
|                 } | ||||
|                 $total                               = $limit->start_date->diffInDays($limit->end_date) + 1; // include the day itself.
 | ||||
|                 $total                               = $limit->start_date->diffInDays($limit->end_date, true) + 1; // include the day itself.
 | ||||
|                 $days                                = $this->daysInOverlap($limit, $start, $end); | ||||
|                 $amount                              = bcmul(bcdiv($limit->amount, (string)$total), (string)$days); | ||||
|                 $return[$currencyCode]['sum']        = bcadd($return[$currencyCode]['sum'], $amount); | ||||
| @@ -183,21 +183,21 @@ class BudgetRepository implements BudgetRepositoryInterface | ||||
|         //    |-----------|
 | ||||
|         //  |----------------|
 | ||||
|         if ($start->gte($limit->start_date) && $end->lte($limit->end_date)) { | ||||
|             return $start->diffInDays($end) + 1; // add one day
 | ||||
|             return (int) $start->diffInDays($end, true) + 1; // add one day
 | ||||
|         } | ||||
|         // limit starts earlier and limit ends first:
 | ||||
|         //    |-----------|
 | ||||
|         // |-------|
 | ||||
|         if ($limit->start_date->lte($start) && $limit->end_date->lte($end)) { | ||||
|             // return days in the range $start-$limit_end
 | ||||
|             return $start->diffInDays($limit->end_date) + 1; // add one day, the day itself
 | ||||
|             return (int) $start->diffInDays($limit->end_date, true) + 1; // add one day, the day itself
 | ||||
|         } | ||||
|         // limit starts later and limit ends earlier
 | ||||
|         //    |-----------|
 | ||||
|         //           |-------|
 | ||||
|         if ($limit->start_date->gte($start) && $limit->end_date->gte($end)) { | ||||
|             // return days in the range $limit_start - $end
 | ||||
|             return $limit->start_date->diffInDays($end) + 1; // add one day, the day itself
 | ||||
|             return (int) $limit->start_date->diffInDays($end, true) + 1; // add one day, the day itself
 | ||||
|         } | ||||
| 
 | ||||
|         return 0; | ||||
|   | ||||
| @@ -51,7 +51,7 @@ class OperationsRepository implements OperationsRepositoryInterface | ||||
|         $total = '0'; | ||||
|         $count = 0; | ||||
|         foreach ($budget->budgetlimits as $limit) { | ||||
|             $diff   = $limit->start_date->diffInDays($limit->end_date); | ||||
|             $diff   = (int) $limit->start_date->diffInDays($limit->end_date, true); | ||||
|             $diff   = 0 === $diff ? 1 : $diff; | ||||
|             $amount = $limit->amount; | ||||
|             $perDay = bcdiv($amount, (string)$diff); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user