Fix chart

This commit is contained in:
James Cole
2023-08-01 09:42:59 +02:00
parent 8504d55f17
commit 8162b22d43
2 changed files with 71 additions and 42 deletions

View File

@@ -29,6 +29,7 @@ use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Generic\DateRequest;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Administration\Account\AccountRepositoryInterface;
use FireflyIII\Support\Http\Api\ConvertsExchangeRates;
use FireflyIII\User;
@@ -90,9 +91,10 @@ class AccountController extends Controller
// user's preferences
$defaultSet = $this->repository->getAccountsByType([AccountType::ASSET, AccountType::DEFAULT])->pluck('id')->toArray();
$frontPage = app('preferences')->get('frontPageAccounts', $defaultSet);
$default = app('amount')->getDefaultCurrency();
$accounts = $this->repository->getAccountsById($frontPage->data);
$chartData = [];
/** @var TransactionCurrency $default */
$default = app('amount')->getDefaultCurrency();
$accounts = $this->repository->getAccountsById($frontPage->data);
$chartData = [];
if (!(is_array($frontPage->data) && count($frontPage->data) > 0)) {
$frontPage->data = $defaultSet;
@@ -113,11 +115,11 @@ class AccountController extends Controller
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
// the default currency of the user (may be the same!)
'native_id' => $default->id,
// the default currency of the user (could be the same!)
'native_id' => (int)$default->id,
'native_code' => $default->code,
'native_symbol' => $default->symbol,
'native_decimal_places' => $default->decimal_places,
'native_decimal_places' => (int)$default->decimal_places,
'start_date' => $start->toAtomString(),
'end_date' => $end->toAtomString(),
'entries' => [],