mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Invert stuff so chart works again.
This commit is contained in:
parent
6f08482aaf
commit
98fd5b8858
@ -327,9 +327,9 @@ class CategoryController extends Controller
|
|||||||
return $category->name;
|
return $category->name;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
$entries = $this->filterCollection($start, $end, $set, $categories);
|
||||||
$entries = $this->filterCollection($start, $end, $set, $categories);
|
$entries = $this->invertSelection($entries);
|
||||||
$data = $this->generator->spentInPeriod($categories, $entries);
|
$data = $this->generator->spentInPeriod($categories, $entries);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
@ -362,7 +362,7 @@ class CategoryController extends Controller
|
|||||||
}
|
}
|
||||||
)->first();
|
)->first();
|
||||||
if (!is_null($entry)) {
|
if (!is_null($entry)) {
|
||||||
$row[] = round($entry->earned, 2);
|
$row[] = $entry->earned ? round($entry->earned, 2) : round($entry->spent, 2);
|
||||||
} else {
|
} else {
|
||||||
$row[] = 0;
|
$row[] = 0;
|
||||||
}
|
}
|
||||||
@ -374,6 +374,27 @@ class CategoryController extends Controller
|
|||||||
return $entries;
|
return $entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $entries
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
private function invertSelection(Collection $entries): Collection
|
||||||
|
{
|
||||||
|
$result = new Collection;
|
||||||
|
foreach ($entries as $entry) {
|
||||||
|
$new = [$entry[0]];
|
||||||
|
$count = count($entry);
|
||||||
|
for ($i = 1; $i < $count; $i++) {
|
||||||
|
$new[$i] = ($entry[$i] * -1);
|
||||||
|
}
|
||||||
|
$result->push($new);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SCRI $repository
|
* @param SCRI $repository
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
|
Loading…
Reference in New Issue
Block a user