View Issue Details

IDProjectCategoryView StatusLast Update
0023260mantisbtcustom fieldspublic2017-10-08 23:52
ReportercproensaAssigned Tocproensa 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version2.6.0 
Target Version2.7.0Fixed in Version2.7.0 
Summary0023260: Custom fields of type date are not sorted correctly
Description

The filter query does outer join with the custom field values table.
This has three kind of values_
1) A timestamp, when there is a field related to the issue, and the field is informed.
2) An empty string, when there is a field related to the issue, and the field is not informed
3) A null value, when there is not a field related to the issue, due to the outer join.

When sorting, the result is ordered, eg: mysql: 3 < 2 < 1
Other databases may place nulls last, but still, the empty value (2) can mess the expected result.

The expected result for sorting is:

  • For ASC order, informed values (1) are placed first in asc order, and then, empty values (2) and (3) afterwards
  • For DESC order, informed values (1) are placed first in desc order, and then, empty values (2) and (3) afterwards
TagsNo tags attached.

Relationships

related to 0023241 closedcproensa Error when changing sort order in filters, due date field only 
child of 0023443 closedcproensa Fixes related to custom fields on filters, columns and visibility 

Activities

atrol

atrol

2017-08-27 04:57

developer   ~0057549

Is there any difference between 2) empty and 3) null for the end user?
I am not aware there is one, so I prefer any solution that might provide the better performance.

cproensa

cproensa

2017-08-27 06:34

developer   ~0057552

Is there any difference between 2) empty and 3) null for the end user?

Currently, i think they are treated the same, for any custom field. See for example: 0003738:0017810

My concern is, should the empty values, when that field allows empty values to be entered, be ordered before the actual data?
(This applies to other type fields too). If so, this has some difficulties like: no easy way to know (in the sql query) if the filed allows empty values
I think I prefer to leave out those empty values, and manage them with other filter options (eg, fixing 0004864 0017810)

Related Changesets

MantisBT: master dc68e440

2017-08-25 20:03:15

cproensa


Committer: dregad Details Diff
Fix sorting for number based custom fields

For types numeric, float, and dates
- Make nulls appear last in the ordered result.
- Cast the values to sort them numerically.

Fixes: 0023260, 0006872
mod - core/filter_api.php Diff File

Issue History

Date Modified Username Field Change
2017-08-23 18:16 cproensa New Issue
2017-08-23 18:18 cproensa Description Updated View Revisions
2017-08-24 03:34 dregad Relationship added related to 0023241
2017-08-26 13:13 cproensa Status new => assigned
2017-08-26 13:13 cproensa Assigned To => cproensa
2017-08-27 04:57 atrol Note Added: 0057549
2017-08-27 06:34 cproensa Note Added: 0057552
2017-10-07 12:45 dregad Changeset attached => MantisBT master dc68e440
2017-10-07 12:45 cproensa Status assigned => resolved
2017-10-07 12:45 cproensa Resolution open => fixed
2017-10-07 12:45 cproensa Fixed in Version => 2.7.0
2017-10-07 13:32 atrol Target Version => 2.7.0
2017-10-08 11:50 cproensa Relationship added child of 0023443
2017-10-08 23:52 vboctor Status resolved => closed