mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 09:52:20 +00:00
Fix division by zero.
This commit is contained in:
@@ -283,7 +283,7 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
if (is_null($year)) {
|
if (is_null($year)) {
|
||||||
$query->whereNull('date');
|
$query->whereNull('date');
|
||||||
}
|
}
|
||||||
$tags = $query->orderBy('id','desc')->get();
|
$tags = $query->orderBy('id', 'desc')->get();
|
||||||
$temporary = [];
|
$temporary = [];
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
$amount = floatval($this->sumOfTag($tag, null, null));
|
$amount = floatval($this->sumOfTag($tag, null, null));
|
||||||
@@ -339,7 +339,11 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
{
|
{
|
||||||
$amountDiff = $max - $min;
|
$amountDiff = $max - $min;
|
||||||
$diff = $range[1] - $range[0];
|
$diff = $range[1] - $range[0];
|
||||||
|
$step = 1;
|
||||||
|
if ($diff !== 0) {
|
||||||
$step = $amountDiff / $diff;
|
$step = $amountDiff / $diff;
|
||||||
|
}
|
||||||
|
|
||||||
$extra = round($amount / $step);
|
$extra = round($amount / $step);
|
||||||
|
|
||||||
return intval($range[0] + $extra);
|
return intval($range[0] + $extra);
|
||||||
|
|||||||
Reference in New Issue
Block a user