mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Add primary to array.
This commit is contained in:
@@ -755,10 +755,11 @@ class Steam
|
|||||||
|
|
||||||
private function getCurrencies(Collection $accounts): array
|
private function getCurrencies(Collection $accounts): array
|
||||||
{
|
{
|
||||||
$currencies = [];
|
$currencies = [];
|
||||||
$accountCurrencies = [];
|
$accountCurrencies = [];
|
||||||
$accountPreferences = [];
|
$accountPreferences = [];
|
||||||
$primary = Amount::getPrimaryCurrency();
|
$primary = Amount::getPrimaryCurrency();
|
||||||
|
$currencies[$primary->id] = $primary;
|
||||||
|
|
||||||
$ids = $accounts->pluck('id')->toArray();
|
$ids = $accounts->pluck('id')->toArray();
|
||||||
$result = AccountMeta::whereIn('account_id', $ids)->where('name', 'currency_id')->get();
|
$result = AccountMeta::whereIn('account_id', $ids)->where('name', 'currency_id')->get();
|
||||||
@@ -770,8 +771,8 @@ class Steam
|
|||||||
$accountPreferences[(int)$item->account_id] = $integer;
|
$accountPreferences[(int)$item->account_id] = $integer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// collect those currencies.
|
// collect those currencies, skip primary because we already have it.
|
||||||
$set = TransactionCurrency::whereIn('id', $accountPreferences)->get();
|
$set = TransactionCurrency::whereIn('id', $accountPreferences)->where('id','!=',$primary->id)->get();
|
||||||
foreach ($set as $item) {
|
foreach ($set as $item) {
|
||||||
$currencies[$item->id] = $item;
|
$currencies[$item->id] = $item;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user