temp fix for infinite-loop during login (disabled auto-abbreviations for algo types)
This commit is contained in:
1 parent
5eb890844d
commit
459255f20f
1 file changed
+18
-13
@@ -41,23 +41,23 @@ namespace mbts.spark.utilities {
|
||||
static readonly OrderMetadata _default_order_metadata = new OrderMetadata { KeyBinding = "", Color = BTSColors.Orders.default_order };
|
||||
readonly AdminModel _admin_model;
|
||||
readonly DynamicOrderHelper _dynamic_helper;
|
||||
readonly IReadOnlyDictionary<OneOf<CustomOrderDefinition.CustomOneofCase, string>, string> _algo_abbreviation_index;
|
||||
//readonly IReadOnlyDictionary<OneOf<CustomOrderDefinition.CustomOneofCase, string>, string> _algo_abbreviation_index;
|
||||
IDisposable _dispose;
|
||||
|
||||
[ImportingConstructor]
|
||||
public OrderFactory(AdminModel admin_model, DynamicOrderHelper dynamic_helper) {
|
||||
_admin_model = admin_model;
|
||||
_dynamic_helper = dynamic_helper;
|
||||
var algo_name_index = new HashSet<OneOf<CustomOrderDefinition.CustomOneofCase, string>>(OneOf<CustomOrderDefinition.CustomOneofCase,string>.ValueEqualityComparer);
|
||||
// add standard types
|
||||
algo_name_index.AddRange(
|
||||
EnumHelper.get_values_except(CustomOrderDefinition.CustomOneofCase.None)
|
||||
.Select(t => new OneOf<CustomOrderDefinition.CustomOneofCase, string>(t)));
|
||||
// add dynamic types
|
||||
algo_name_index.AddRange(dynamic_helper.dynamic_types
|
||||
.Select(dt => new OneOf<CustomOrderDefinition.CustomOneofCase, string>(dt)));
|
||||
// build abbreviation index
|
||||
_algo_abbreviation_index = DisplayNameHelper.get_word_tree_abbreviations(algo_name_index, oneof => oneof.value.ToString(), OneOf<CustomOrderDefinition.CustomOneofCase,string>.ValueEqualityComparer);
|
||||
//var algo_name_index = new HashSet<OneOf<CustomOrderDefinition.CustomOneofCase, string>>(OneOf<CustomOrderDefinition.CustomOneofCase,string>.ValueEqualityComparer);
|
||||
//// add standard types
|
||||
//algo_name_index.AddRange(
|
||||
// EnumHelper.get_values_except(CustomOrderDefinition.CustomOneofCase.None)
|
||||
// .Select(t => new OneOf<CustomOrderDefinition.CustomOneofCase, string>(t)));
|
||||
//// add dynamic types
|
||||
//algo_name_index.AddRange(dynamic_helper.dynamic_types
|
||||
// .Select(dt => new OneOf<CustomOrderDefinition.CustomOneofCase, string>(dt)));
|
||||
//// build abbreviation index
|
||||
//_algo_abbreviation_index = DisplayNameHelper.get_word_tree_abbreviations(algo_name_index, oneof => oneof.value.ToString(), OneOf<CustomOrderDefinition.CustomOneofCase,string>.ValueEqualityComparer);
|
||||
}
|
||||
|
||||
public IObservable<IReadOnlyDictionary<uint, string>> subscribe_accounts() => _admin_model.on_accounts;
|
||||
@@ -187,8 +187,13 @@ namespace mbts.spark.utilities {
|
||||
public string abbreviate_algo(OneOf<CustomOrderDefinition.CustomOneofCase, string> id) {
|
||||
if (id == null)
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
if (id.value is string)
|
||||
return _algo_abbreviation_index.TryGetValue(id, out string abb) ? abb : id.value.ToString();
|
||||
// Temp Fix (begin)
|
||||
if (id.value is string str)
|
||||
return str;
|
||||
// Temp Fix (end)
|
||||
// TODO: when logical abbreviations are fixed, uncomment the 2 lines below and remove the 'Temp Fix' above.
|
||||
//if (id.value is string)
|
||||
//return _algo_abbreviation_index.TryGetValue(id, out string abb) ? abb : id.value.ToString();
|
||||
else if (id.value is CustomOrderDefinition.CustomOneofCase t)
|
||||
return OrderDataHelper.abbreviate_algo_type(t);
|
||||
return id.ToString();
|
||||
|
||||
Reference in new issue
Block a user