mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix #266 for period-chart.
This commit is contained in:
@@ -254,18 +254,24 @@ class CategoryController extends Controller
|
|||||||
{
|
{
|
||||||
$categoryCollection = new Collection([$category]);
|
$categoryCollection = new Collection([$category]);
|
||||||
$cache = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
|
/** @var AccountCrudInterface $crud */
|
||||||
|
$crud = app(AccountCrudInterface::class);
|
||||||
|
$accounts = $crud->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||||
|
|
||||||
$cache->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$cache->addProperty($end);
|
$cache->addProperty($end);
|
||||||
|
$cache->addProperty($accounts);
|
||||||
$cache->addProperty($category->id);
|
$cache->addProperty($category->id);
|
||||||
$cache->addProperty('specific-period');
|
$cache->addProperty('specific-period');
|
||||||
|
|
||||||
|
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return $cache->get();
|
return $cache->get();
|
||||||
}
|
}
|
||||||
$entries = new Collection;
|
$entries = new Collection;
|
||||||
while ($start <= $end) {
|
while ($start <= $end) {
|
||||||
$spent = $repository->spentInPeriod($categoryCollection, new Collection, $start, $start);
|
$spent = $repository->spentInPeriod($categoryCollection, $accounts, $start, $start);
|
||||||
$earned = $repository->earnedInPeriod($categoryCollection, new Collection, $start, $start);
|
$earned = $repository->earnedInPeriod($categoryCollection, $accounts, $start, $start);
|
||||||
$date = Navigation::periodShow($start, '1D');
|
$date = Navigation::periodShow($start, '1D');
|
||||||
$entries->push([clone $start, $date, $spent, $earned]);
|
$entries->push([clone $start, $date, $spent, $earned]);
|
||||||
$start->addDay();
|
$start->addDay();
|
||||||
|
|||||||
Reference in New Issue
Block a user