Big refactor to remove the deprecated transaction collector.

This commit is contained in:
James Cole
2019-05-30 12:31:19 +02:00
parent 10a6ff9bf8
commit 8b7e87ae57
117 changed files with 1314 additions and 1208 deletions

View File

@@ -121,7 +121,7 @@ class ChartJsGenerator implements GeneratorInterface
$labels = \is_array($first['entries']) ? array_keys($first['entries']) : [];
$chartData = [
'count' => \count($data),
'count' => count($data),
'labels' => $labels, // take ALL labels from the first set.
'datasets' => [],
];

View File

@@ -30,7 +30,6 @@ use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Generator\Report\Support;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\Tag;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionType;
use Illuminate\Support\Collection;
use Log;
@@ -79,7 +78,7 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
$reportType = 'tag';
$expenses = $this->getExpenses();
$income = $this->getIncome();
$accountSummary = $this->getObjectSummary($this->summarizeByAccount($expenses), $this->summarizeByAccount($income));
$accountSummary = $this->getObjectSummary($this->summarizeByAssetAccount($expenses), $this->summarizeByAssetAccount($income));
$tagSummary = $this->getObjectSummary($this->summarizeByTag($expenses), $this->summarizeByTag($income));
$averageExpenses = $this->getAverages($expenses, SORT_ASC);
$averageIncome = $this->getAverages($income, SORT_DESC);
@@ -163,12 +162,14 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
$result = [];
/** @var array $journal */
foreach ($array as $journal) {
/** @var Tag $journalTag */
foreach ($journal['tag_ids'] as $journalTag) {
$journalTagId = (int)$journalTag;
if (\in_array($journalTagId, $tagIds, true)) {
$result[$journalTagId] = $result[$journalTagId] ?? '0';
$result[$journalTagId] = bcadd($journal['amount'], $result[$journalTagId]);
/**
* @var int $id
* @var array $tag
*/
foreach ($journal['tags'] as $id => $tag) {
if (in_array($id, $tagIds, true)) {
$result[$id] = $result[$id] ?? '0';
$result[$id] = bcadd($journal['amount'], $result[$id]);
}
}
}