Small code improv #3578

This commit is contained in:
James Cole
2020-07-27 07:08:29 +02:00
parent fade9ae6f9
commit 7017d33b87
2 changed files with 8 additions and 8 deletions

View File

@@ -137,8 +137,7 @@ class JavascriptController extends Controller
$currency = $repository->getAccountCurrency($account) ?? $currency;
}
$localeconv = app('amount')->getLocaleInfo();
$accounting = app('amount')->getJsConfig($localeconv);
$accounting = app('amount')->getJsConfig();
$accounting['frac_digits'] = $currency->decimal_places;
$pref = app('preferences')->get('language', config('firefly.default_language', 'en_US'));
/** @noinspection NullPointerExceptionInspection */

View File

@@ -115,12 +115,13 @@ class Amount
* This method returns the correct format rules required by accounting.js,
* the library used to format amounts in charts.
*
* @param array $config
* Used only in one place.
*
* @return array
*/
public function getJsConfig(array $config): array
public function getJsConfig(): array
{
$config = $this->getLocaleInfo();
$negative = self::getAmountJsConfig($config['n_sep_by_space'], $config['n_sign_posn'], $config['negative_sign'], $config['n_cs_precedes']);
$positive = self::getAmountJsConfig($config['p_sep_by_space'], $config['p_sign_posn'], $config['positive_sign'], $config['p_cs_precedes']);
@@ -138,7 +139,7 @@ class Amount
/**
* @return array
*/
public function getLocaleInfo(): array
private function getLocaleInfo(): array
{
// get config from preference, not from translation:
$locale = app('steam')->getLocale();