mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Join two charts, simpler code.
This commit is contained in:
@@ -49,20 +49,18 @@ class ReportController extends Controller
|
||||
* This chart, by default, is shown on the multi-year and year report pages,
|
||||
* which means that giving it a 2 week "period" should be enough granularity.
|
||||
*
|
||||
* @param string $reportType
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function netWorth(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
||||
public function netWorth(Carbon $start, Carbon $end, Collection $accounts)
|
||||
{
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty('netWorth');
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($reportType);
|
||||
$cache->addProperty($accounts);
|
||||
$cache->addProperty($end);
|
||||
if ($cache->has()) {
|
||||
|
@@ -29,6 +29,7 @@ class BudgetController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @param BudgetReportHelperInterface $helper
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
@@ -36,22 +37,20 @@ class BudgetController extends Controller
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function budgetMultiYear(BudgetReportHelperInterface $helper, Carbon $start, Carbon $end, Collection $accounts)
|
||||
public function budgetPeriodReport(BudgetReportHelperInterface $helper, Carbon $start, Carbon $end, Collection $accounts)
|
||||
{
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('budget-mult-year-report');
|
||||
$cache->addProperty('budget-period-report');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
//return $cache->get();
|
||||
}
|
||||
|
||||
|
||||
$years = $helper->listOfYears($start, $end);
|
||||
$budgetMultiYear = $helper->getBudgetMultiYear($start, $end, $accounts);
|
||||
|
||||
$result = view('reports.partials.budget-multi-year', compact('budgetMultiYear', 'years'))->render();
|
||||
$periods = $helper->listOfPeriods($start, $end);
|
||||
$budgets = $helper->getBudgetPeriodReport($start, $end, $accounts);
|
||||
$result = view('reports.partials.budget-period', compact('budgets', 'periods'))->render();
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
@@ -86,35 +85,4 @@ class BudgetController extends Controller
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BudgetReportHelperInterface $helper
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function budgetYearOverview(BudgetReportHelperInterface $helper, Carbon $start, Carbon $end, Collection $accounts)
|
||||
{
|
||||
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('budget-year-overview');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
$budgets = $helper->budgetYearOverview($start, $end, $accounts);
|
||||
|
||||
$result = view('reports.partials.budget-year-overview', compact('budgets'))->render();
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -187,6 +187,7 @@ class SplitController extends Controller
|
||||
'transactions' => $this->getTransactionDataFromRequest($request),
|
||||
];
|
||||
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user