Improve sorting by group

Issue #235 resolved
Bernhard Jung repo owner created an issue

A while a go a sort-index was added to groups in general. The index was used to sort elements in the list of selected list of elements.

The index should also be used to sort the tabs, thats currently not the case. Some of the groups do not need a individual index, but can be sorted by name or abbreviation only. For example the sorting of spell groups by index is

  1. Spell
  2. Rituals
  3. Everything else
  4. Cantrips

The the groups in the 3rd group can all have the same index and shoud be sorted by name/abbreviation within this group.

It might make sense to sort all lists in the rules store once after the rules have been created. The general order of sorting should be as follows although this will not always be what is needed.

  1. index
  2. abbreviation
  3. name
  4. ID

Sorting by name after abbreviation is needed because some groups have the same abbreviation but different names, All groups ‘Animistenkräfte' have the abbr ‘Animistenkräfte’ but the names include the type of Animist ('Animistenkräfte (Zauberschmiede)', ‘Animistenkräfte (Tierkrieger)’).

In some cases one would not want to sort by abbreviation first, but by name depending on what ist displayed to the user. In these cases it would still make sense to have a default sorting as described above as it prevents elements from being ‘sorted’ randomly in other places and a explicit call to the correct sort function would be needed anyway, no matter if the elements are unsorted or sorted the wrong way.

Comments (1)

  1. Bernhard Jung reporter

    Resolved in commit 6a1dc35

    The elements are now sorted by default like this.

    1. By Type. This is done by enum value. This is usally not necessary as there are no lists where e. g. Spells and Attributes are in one list.
    2. Index. Only for groups. Normal Rule Elements with a index, e. g. Attributes, are not affected by this.
    3. Abbreviation. This is optional in the sorting algorithm and can be turned off, but after loading the rules all list are sorted with this sort criteria turned on.
    4. Name.
    5. ID
  2. Log in to comment