Update for balance box in report.

This commit is contained in:
James Cole
2019-08-16 17:54:38 +02:00
parent 070f46c755
commit 02db333d46
9 changed files with 190 additions and 83 deletions

View File

@@ -47,7 +47,6 @@ class BalanceController extends Controller
*/
public function general(Collection $accounts, Carbon $start, Carbon $end)
{
// chart properties for cache:
$cache = new CacheProperties;
$cache->addProperty($start);
@@ -55,17 +54,19 @@ class BalanceController extends Controller
$cache->addProperty('balance-report');
$cache->addProperty($accounts->pluck('id')->toArray());
if ($cache->has()) {
return $cache->get(); // @codeCoverageIgnore
//return $cache->get(); // @codeCoverageIgnore
}
$helper = app(BalanceReportHelperInterface::class);
$balance = $helper->getBalanceReport($accounts, $start, $end);
try {
$result = view('reports.partials.balance', compact('balance'))->render();
$report = $helper->getBalanceReport($accounts, $start, $end);
// TODO no budget.
// TODO sum over account.
// try {
$result = view('reports.partials.balance', compact('report'))->render();
// @codeCoverageIgnoreStart
} catch (Throwable $e) {
Log::debug(sprintf('Could not render reports.partials.balance: %s', $e->getMessage()));
$result = 'Could not render view.';
}
// } catch (Throwable $e) {
// Log::debug(sprintf('Could not render reports.partials.balance: %s', $e->getMessage()));
// $result = 'Could not render view.';
// }
// @codeCoverageIgnoreEnd
$cache->store($result);