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:
parent
275d19e71d
commit
57b5981904
@ -254,18 +254,24 @@ class CategoryController extends Controller
|
||||
{
|
||||
$categoryCollection = new Collection([$category]);
|
||||
$cache = new CacheProperties;
|
||||
/** @var AccountCrudInterface $crud */
|
||||
$crud = app(AccountCrudInterface::class);
|
||||
$accounts = $crud->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty($accounts);
|
||||
$cache->addProperty($category->id);
|
||||
$cache->addProperty('specific-period');
|
||||
|
||||
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
}
|
||||
$entries = new Collection;
|
||||
while ($start <= $end) {
|
||||
$spent = $repository->spentInPeriod($categoryCollection, new Collection, $start, $start);
|
||||
$earned = $repository->earnedInPeriod($categoryCollection, new Collection, $start, $start);
|
||||
$spent = $repository->spentInPeriod($categoryCollection, $accounts, $start, $start);
|
||||
$earned = $repository->earnedInPeriod($categoryCollection, $accounts, $start, $start);
|
||||
$date = Navigation::periodShow($start, '1D');
|
||||
$entries->push([clone $start, $date, $spent, $earned]);
|
||||
$start->addDay();
|
||||
|
Loading…
Reference in New Issue
Block a user