Sorting issue

Found a bug or strange behavior on WoW-Heroes? Help us squash it by reporting it here!
Posts: 1

Sorting issue

Post#1 » Mon Dec 15, 2008 4:05 pm

I'm a developer myself and noticed a classic issue. The scores are sorted as text and not by numbers. Therefore, 200 is > 1000. To get things to sort correctly, you should cast the number before sorting.

MySQL Cast Example:
CAST(score AS INT)

However, a better alternative is to store the number as an integer. Then, a cast is not required, storage space is reduced, and performance increases.

User avatar
Site Admin
Site Admin
Posts: 747

Re: Sorting issue

Post#2 » Mon Dec 15, 2008 5:50 pm

Ah, the problem is not in MySQL, it sorts ok (as int) when you use cache report. When you use live report, javascript should do the sorting after all characters have been loaded (or when you press abort button), but it could be that it's not sorting well, I'll take a look. Thanks for pointing this out :)

Return to “Bug reports”

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests