mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-16 18:25:00 -06:00
Clean up code
This commit is contained in:
parent
8162b22d43
commit
8d55f7f2e5
@ -143,7 +143,6 @@ class AccountController extends Controller
|
||||
$currentSet['entries'][$label] = $balance;
|
||||
$currentSet['converted_entries'][$label] = $balanceConverted;
|
||||
}
|
||||
$currentSet = $this->cerChartSet($currentSet);
|
||||
$chartData[] = $currentSet;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Administration\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Api\ConvertsExchangeRates;
|
||||
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@ -66,9 +67,9 @@ class BalanceController extends Controller
|
||||
*
|
||||
* @param BalanceChartRequest $request
|
||||
*
|
||||
* @return string
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function balance(BalanceChartRequest $request): string
|
||||
public function balance(BalanceChartRequest $request): JsonResponse
|
||||
{
|
||||
$params = $request->getAll();
|
||||
/** @var Carbon $start */
|
||||
@ -78,7 +79,6 @@ class BalanceController extends Controller
|
||||
/** @var Collection $accounts */
|
||||
$accounts = $params['accounts'];
|
||||
$preferredRange = $params['period'];
|
||||
$convert = $params['convert'];
|
||||
|
||||
// set some formats, based on input parameters.
|
||||
$format = app('navigation')->preferredCarbonFormatByPeriod($preferredRange);
|
||||
@ -188,7 +188,7 @@ class BalanceController extends Controller
|
||||
foreach ($data as $currency) {
|
||||
// income and expense array prepped:
|
||||
$income = [
|
||||
'label' => 'earned',
|
||||
'label' => sprintf('earned-%s', $currency['currency_code']),
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@ -201,7 +201,7 @@ class BalanceController extends Controller
|
||||
'converted_entries' => [],
|
||||
];
|
||||
$expense = [
|
||||
'label' => 'spent',
|
||||
'label' => sprintf('spent-%s', $currency['currency_code']),
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@ -234,12 +234,9 @@ class BalanceController extends Controller
|
||||
$chartData[] = $income;
|
||||
$chartData[] = $expense;
|
||||
}
|
||||
var_dump($chartData);
|
||||
exit;
|
||||
|
||||
//$data = $this->generator->multiSet($chartData);
|
||||
|
||||
return response()->json($data);
|
||||
return response()->json($chartData);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ class BalanceChartRequest extends FormRequest
|
||||
'start' => $this->getCarbonDate('start'),
|
||||
'end' => $this->getCarbonDate('end'),
|
||||
'accounts' => $this->getAccountList(),
|
||||
'convert' => $this->boolean('convert'),
|
||||
'period' => $this->string('period'),
|
||||
];
|
||||
}
|
||||
@ -57,7 +56,6 @@ class BalanceChartRequest extends FormRequest
|
||||
return [
|
||||
'start' => 'required|date|after:1900-01-01|before:2099-12-31',
|
||||
'end' => 'required|date|after_or_equal:start|before:2099-12-31|after:1900-01-01',
|
||||
'convert' => 'nullable|between:0,1|numeric',
|
||||
'accounts.*' => 'required|exists:accounts,id',
|
||||
'period' => sprintf('required|in:%s', join(',', config('firefly.valid_view_ranges'))),
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user