RiskManagement view updates when imported row overwrites existing one

This commit is contained in:
John Colvin committed 2020-08-20 11:14:56 -05:00
1 parent fbed8e5428
commit f790b8f59b
1 file changed
+3 -2
@@ -15,7 +15,6 @@ using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Reactive.Linq;
using System.Windows.Controls;
@@ -410,11 +409,13 @@ namespace bts.shell.risk_management {
res = res.with(security: sec_md.security);
if (string.IsNullOrEmpty(res.account_name) && accounts.TryGetFirst(a => a?.id == res.account_key, out var acc))
res = res.with(account: acc);
if (_row_cache.TryGetValue(res.key, out var old_row))
rows.RemoveSorted(old_row, row_comparer);
var new_row = RiskLimitsVM.create_placeholder(res);
_row_cache[res.key] = new_row;
_imported_row_map[res.key] = new_row;
if (new_row.account_key == selected_account?.id)
rows.InsertOrReplaceSorted(new_row, row_comparer);
rows.InsertSorted(new_row, row_comparer);
}
}
}