Move collecting journals to the collector.

This commit is contained in:
James Cole
2016-11-05 11:44:41 +01:00
parent 43afdb021a
commit 8e542531b3
6 changed files with 23 additions and 47 deletions

View File

@@ -14,7 +14,7 @@ declare(strict_types = 1);
namespace FireflyIII\Generator\Chart\Bill;
use FireflyIII\Models\Bill;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\Transaction;
use Illuminate\Support\Collection;
/**
@@ -61,13 +61,13 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
$minAmount = [];
$maxAmount = [];
$actualAmount = [];
/** @var TransactionJournal $entry */
/** @var Transaction $entry */
foreach ($entries as $entry) {
$data['labels'][] = $entry->date->formatLocalized($format);
$minAmount[] = round($bill->amount_min, 2);
$maxAmount[] = round($bill->amount_max, 2);
// journalAmount has been collected in BillRepository::getJournals
$actualAmount[] = round(TransactionJournal::amountPositive($entry), 2);
$actualAmount[] = bcmul($entry->transaction_amount, '-1');
}
$data['datasets'][] = [