Remove unused code.

This commit is contained in:
James Cole 2020-07-25 08:19:31 +02:00
parent 5e1306282a
commit 4b16d7c53d
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D

View File

@ -89,12 +89,10 @@ class FrontpageChartGenerator
foreach ($categories as $category) {
// get expenses
$collection[] = $this->collectExpenses($category, $accounts);
//$collection[] = $this->collectIncome($category, $accounts);
}
// collect for no-category:
$collection[] = $this->collectNoCatExpenses($accounts);
//$collection[] = $this->collectNoCatIncome($accounts);
$tempData = array_merge(...$collection);
@ -146,29 +144,6 @@ class FrontpageChartGenerator
return $tempData;
}
/**
* @param Category $category
* @param Collection $accounts
*
* @return array
*/
private function collectIncome(Category $category, Collection $accounts): array
{
$spent = $this->opsRepos->sumIncome($this->start, $this->end, $accounts, new Collection([$category]));
$tempData = [];
foreach ($spent as $currency) {
$this->addCurrency($currency);
$tempData[] = [
'name' => $category->name,
'sum' => $currency['sum'],
'sum_float' => round($currency['sum'], $currency['currency_decimal_places']),
'currency_id' => (int) $currency['currency_id'],
];
}
return $tempData;
}
/**
* @param Collection $accounts
*
@ -184,28 +159,8 @@ class FrontpageChartGenerator
'name' => trans('firefly.no_category'),
'sum' => $currency['sum'],
'sum_float' => round($currency['sum'], $currency['currency_decimal_places'] ?? 2),
'currency_id' => (int) $currency['currency_id'],];
}
return $tempData;
}
/**
* @param Collection $accounts
*
* @return array
*/
private function collectNoCatIncome(Collection $accounts): array
{
$noCatExp = $this->noCatRepos->sumIncome($this->start, $this->end, $accounts);
$tempData = [];
foreach ($noCatExp as $currency) {
$this->addCurrency($currency);
$tempData[] = [
'name' => trans('firefly.no_category'),
'sum' => $currency['sum'],
'sum_float' => round($currency['sum'], $currency['currency_decimal_places'] ?? 2),
'currency_id' => (int) $currency['currency_id'],];
'currency_id' => (int) $currency['currency_id'],
];
}
return $tempData;
@ -231,14 +186,6 @@ class FrontpageChartGenerator
'currency_symbol' => $currency['currency_symbol'],
'entries' => $names,
];
// $key = sprintf('earned-%d', $currencyId);
// $return[$key] = [
// 'label' => sprintf('%s (%s)', (string) trans('firefly.earned'), $currency['currency_name']),
// 'type' => 'bar',
// 'currency_symbol' => $currency['currency_symbol'],
// 'data_type' => 'earned',
// 'entries' => $names,
// ];
}
return $return;