Skip to content

Commit

Permalink
Merge pull request #331 from kdmukai/multiselect_sort_order
Browse files Browse the repository at this point in the history
[Bugfix] Preserve multiselect sort order
  • Loading branch information
newtonick authored Feb 16, 2023
2 parents 7c1dc71 + 00e612a commit 6ae1d7c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/seedsigner/models/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,11 @@ def get_multiselect_value_display_names(self, attr_name: str) -> List[str]:
raise Exception(f"Unsupported SettingsEntry.type: {settings_entry.type}")

display_names = []
for value in self._data[attr_name]:
display_names.append(settings_entry.get_selection_option_display_name_by_value(value))
# Iterate through the selection_options list in order to preserve intended sort
# order when adding which options are selected.
for value, display_name in settings_entry.selection_options:
if value in self._data[attr_name]:
display_names.append(display_name)
return display_names


Expand Down

0 comments on commit 6ae1d7c

Please sign in to comment.