Fix multi-currency imports (#94)
This commit is contained in:
@@ -54,11 +54,17 @@ class ConfigSheet implements SkipsEmptyRows, ToCollection, WithEvents, WithHeadi
|
||||
$this->backupImport->user->save();
|
||||
break;
|
||||
|
||||
case 'reinvest_dividends':
|
||||
|
||||
Holding::myHoldings()->where('id', $config['value'])->update([
|
||||
'reinvest_dividends' => true,
|
||||
]);
|
||||
case 'reinvested_dividends':
|
||||
if (json_validate($config['value'])) {
|
||||
foreach (json_decode($config['value'], true) as $reinvest) {
|
||||
Holding::myHoldings($this->backupImport->user->id)
|
||||
->where('portfolio_id', $reinvest['portfolio_id'])
|
||||
->where('symbol', $reinvest['symbol'])
|
||||
->update([
|
||||
'reinvest_dividends' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -48,7 +48,7 @@ class TransactionsSheet implements SkipsEmptyRows, ToCollection, WithEvents, Wit
|
||||
// if has any transactions not in base currency, need to sync timeseries conversion rates
|
||||
if ($transactions->where('currency', '!=', config('investbrain.base_currency'))->isNotEmpty()) {
|
||||
|
||||
CurrencyRate::timeSeriesRates('', $transactions->min('date'));
|
||||
CurrencyRate::timeSeriesRates('', $transactions->min('date'), $transactions->max('date'));
|
||||
}
|
||||
|
||||
$totalBatches = count($transactions) / $this->batchSize();
|
||||
|
||||
Reference in New Issue
Block a user