Page MenuHomePhabricator

References in column affect sorting (if no data-sort-type="number" attribute added to heading of column)
Closed, ResolvedPublic

Description

Author: predragbaltic

Description:
During the column's number sorting we have sorting based on text instead on numbers.

Example (Ascending):
1, 10, 100... instead of 1, 2, 3...

Page:
http://sr.wikipedia.org/wiki/Spisak_država_po_stanovništvu


Version: 1.24rc
Severity: enhancement

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:25 PM
bzimport set Reference to bz27745.
bzimport added a subscriber: Unknown Object (MLST).

redekopmark wrote:

seems fixed now, there were mixed number formats causing the error, some numbers were 1,234,567 some where 1.234.567 i've cleaned that up, of course it could also have been fixed in an update in the last month

wabidwoveren wrote:

I am still seeing this bug.

see http://en.wikipedia.org/wiki/List_of_biggest_box_office_bombs and sort by worldwide theater gross. Treasure Planet and Green Lantern are listed incorrectly.

2,986,932 20,915,465 219,851,172 22,852,487

ul2006kevinb wrote:

this seems to depend on references in the table. Check out [[List of NCAA football bowl records]]. The columns without references sort correctly, while the columns with references sort lexically instead. References are changing how a column is sorted: definitely a major bug.

ul2006kevinb wrote:

I have just been told that this is NOT a bug. The reference tag at the end of a number makes the software think it is text, rather than a number, and thus sorts it lexically rather than by value.

Although it is technically not a "bug", it is still something that should be changed IMO. Every table on Wikipedia that has a reference should not be forced to use hidden sorting templates to make it sort correctly. I believe reference tags should be excluded, so that the software ignores them and sorts the data by value as if they were not there.

Sorting on http://en.wikipedia.org/wiki/List_of_biggest_box_office_bombs both by "worldwide theater gross" and "total cost" order the numbers correctly, no matter if they have a reference tag or not.

I cannot see any obvious bug with table sorting on https://en.wikipedia.org/wiki/List_of_NCAA_football_bowl_records either anymore after playing a bit with it.

This seems to be fixed, can somebody confirm? If not, could somebody provide steps to reproduce? Thanks.

(In reply to comment #4)

I have just been told that this is NOT a bug. The reference tag at the end
of a
number makes the software think it is text, rather than a number, and thus
sorts it lexically rather than by value.

I think the table sorter still behaves like this. This can be worked around by adding a data-sort-type="number" attribute to the heading of appropriate column.

This seems to be fixed, can somebody confirm? If not, could somebody provide
steps to reproduce? Thanks.

It's still reproducible, it's just been worked around in the articles linked.

Older versions still exhibit the issue, e.g. for comment 2: https://en.wikipedia.org/w/index.php?title=List_of_box_office_bombs&oldid=467013275 (the workaround is the next edit).

TheDJ set Security to None.
TheDJ removed a subscriber: wikibugs-l-list.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 22 2015, 9:48 AM

Change 426748 had a related patch set uploaded (by MatthiasDD; owner: MatthiasDD):
[mediawiki/core@master] jquery.tablesorter: Improve date parser (only year, BC/AD, asianDate)

https://gerrit.wikimedia.org/r/426748

Change 428146 had a related patch set uploaded (by MatthiasDD; owner: MatthiasDD):
[mediawiki/core@master] jquery.tablesorter: References ignored in sortkey.

https://gerrit.wikimedia.org/r/428146

Change 428146 merged by jenkins-bot:
[mediawiki/core@master] jquery.tablesorter: References ignored in sortkey.

https://gerrit.wikimedia.org/r/428146

matmarex closed this task as Resolved.Apr 23 2018, 5:14 PM
matmarex assigned this task to MatthiasDD.
matmarex removed a project: Patch-For-Review.