Content
View differences
Updated by Ivan Kuchin over 1 year ago
Custom fields with format `list`, `user` and `version` allow multi-value select, though ordering is handled only for the multi-value list format, and is done differently then for single-value list format. While order of selection of items is stored, it is not explicit that the order is meaningful and interface doesn't allow moving items (when editing value for work package it is not possible to just change the order of values, it first needs to be set to a empty or different one).
For `user` and `version` ordering works, as if there was only first value. For `user` the order is by `lastname`, `firstname` then `id`. For version it is alphabetically by the name of the version (<mention class="mention" data-id="57550" data-type="work_package" data-text="#57550">#57550</mention>).
Also ordering for multi-value list format works different from single value format. Single-value orders projects/work packages by the position of selected item in the list, but multi-value orders by first sorting selected values by position in the list, then joining them using `.` and ordering alphabetically by resulting string. See example at the end.
Acceptance criteria:
* It should be possible to order by custom fields with enabled multi-select of formats `list`, `user` and `version`.
* It should be possible to order by such custom fields both projects and work packages.
* The order should reverse when switching from ascending to descending order.
* Ordering for list custom field should happen by position of selected values in the list and not alphabetically. So if custom field list has items `x`, `b` and `a` in that order, then ordering projects/work packages should follow that order and not order them `a`, `b`, `x`.
* Ordering for `user` custom field should happen first by `lastname`, then by `firstname`, then by `email` of selected users.
* Ordering for `version` custom field should still happen alphabetically, so version `100` should precede version `9` (see <mention class="mention" data-id="57550" data-type="work_package" data-text="#57550">#57550</mention>).
* Ordering projects/work packages with multiple values should ignore in which order were the values added, so for the list custom field, project/work package with values `a` and `x` should precede one with values `b` and `a`. And for ordering project/work package with same values in same or different order (one with `a` and `x` and one with `x` and `a`), next ordering column should determine the order.
Questions:
* [x] Does ordering by multiple items, users, versions makes sense at all? ~~One option is to just remove ability to order by multi-value custom fields.~~ **Yes**
* [x] Should order of values be taken into account or should they be sorted before used for ordering? **No**
* [x] Should multi-value list items be ordered also by position and not alphabetically? **Yes**
* [x] Should we order users by `login` or `email` instead of `id`? This would simplify ordering logic, as it would allow ordering by list of strings and not list of strings mixed with integers. Is it accepted to use this information? **Use** `email`**.**
* [ ] There is already a separate ticket about sorting versions <mention class="mention" data-id="57550" data-type="work_package" data-text="#57550">#57550</mention>
So given following values in order for both custom fields:
<img class="image_resized op-uc-image op-uc-image_inline" style="width:143px;" src="/api/v3/attachments/185711/content">
Ordering by single select values does it according to that order:
<img class="image_resized op-uc-image op-uc-image_inline" style="width:139px;" src="/api/v3/attachments/185714/content">
But multi value makes it harder to understand (ordering is using "100", "100.20", "100.3", "100.3.20", "20", "3", "3.20"):
<img class="image_resized op-uc-image op-uc-image_inline" style="width:123px;" src="/api/v3/attachments/185716/content">
For `user` and `version` ordering works, as if there was only first value. For `user` the order is by `lastname`, `firstname` then `id`. For version it is alphabetically by the name of the version (<mention class="mention" data-id="57550" data-type="work_package" data-text="#57550">#57550</mention>).
Also ordering for multi-value list format works different from single value format. Single-value orders projects/work packages by the position of selected item in the list, but multi-value orders by first sorting selected values by position in the list, then joining them using `.` and ordering alphabetically by resulting string. See example at the end.
Acceptance criteria:
* It should be possible to order by custom fields with enabled multi-select of formats `list`, `user` and `version`.
* It should be possible to order by such custom fields both projects and work packages.
* The order should reverse when switching from ascending to descending order.
* Ordering for list custom field should happen by position of selected values in the list and not alphabetically. So if custom field list has items `x`, `b` and `a` in that order, then ordering projects/work packages should follow that order and not order them `a`, `b`, `x`.
* Ordering for `user` custom field should happen first by `lastname`, then by `firstname`, then by `email` of selected users.
* Ordering for `version` custom field should still happen alphabetically, so version `100` should precede version `9` (see <mention class="mention" data-id="57550" data-type="work_package" data-text="#57550">#57550</mention>).
* Ordering projects/work packages with multiple values should ignore in which order were the values added, so for the list custom field, project/work package with values `a` and `x` should precede one with values `b` and `a`. And for ordering project/work package with same values in same or different order (one with `a` and `x` and one with `x` and `a`), next ordering column should determine the order.
Questions:
* [x] Does ordering by multiple items, users, versions makes sense at all? ~~One option is to just remove ability to order by multi-value custom fields.~~ **Yes**
* [x] Should order of values be taken into account or should they be sorted before used for ordering? **No**
* [x] Should multi-value list items be ordered also by position and not alphabetically? **Yes**
* [x] Should we order users by `login` or `email` instead of `id`? This would simplify ordering logic, as it would allow ordering by list of strings and not list of strings mixed with integers. Is it accepted to use this information? **Use** `email`**.**
* [ ] There is already a separate ticket about sorting versions <mention class="mention" data-id="57550" data-type="work_package" data-text="#57550">#57550</mention>
So given following values in order for both custom fields:
<img class="image_resized op-uc-image op-uc-image_inline" style="width:143px;" src="/api/v3/attachments/185711/content">
Ordering by single select values does it according to that order:
<img class="image_resized op-uc-image op-uc-image_inline" style="width:139px;" src="/api/v3/attachments/185714/content">
But multi value makes it harder to understand (ordering is using "100", "100.20", "100.3", "100.3.20", "20", "3", "3.20"):
<img class="image_resized op-uc-image op-uc-image_inline" style="width:123px;" src="/api/v3/attachments/185716/content">