aaroneiche / do-want

Do Want - Open Source Gift Registry
18 stars 4 forks source link

sorting is inconsistent #43

Open aaroneiche opened 11 years ago

aaroneiche commented 11 years ago

Original author: ke...@envail.com (November 27, 2012 16:19:01)

Sorting works, but it's not consistent.

Example:

I sort my wife's list by Ranking, and it puts Cool Item #1 at the top. I sort by Ranking again. It puts Mediocre Item #2 at the top. I sort by Ranking a third time, but instead of Cool Item #1 being at the top... I see Cool Item #3.

Basically, sorting over and over "randomizes" the list within the sort. I would like it to remain consistent, so that if I sort by Ranking, then sort by Ranking again, and then sort by Ranking one more time, it should look the same as it did after the first sort.

Original issue: http://code.google.com/p/do-want/issues/detail?id=43

aaroneiche commented 11 years ago

From aaron.ei...@gmail.com on November 29, 2012 21:29:35 This is probably a mis-identification. Sorting isn't random, it was just unpredictable in the first 2-3 sorts. The item data was not being sorted coming from the database, and had no initial sort - thus it was showing up in whatever order it came out of the DB (most likely ordered by ID), the first sort would sort, and then the second would reverse. This has been updated and will soon be committed to the master repository.

aaroneiche commented 11 years ago

From aaron.ei...@gmail.com on November 30, 2012 18:44:31 This has been fixed in 3ab87c5d8fe2

commonplace commented 11 years ago

We're actually still seeing this behavior. If my wife sorts her list by ranking so that 5 stars are at the top, then re-sorts it so that 1 stars are at the top, then sorts it again so that 5 stars are back at the top, it's not in the same order as it was initially.

aaroneiche commented 11 years ago

Can you provide some screen shots of this behavior?

commonplace commented 11 years ago

ha! At first, I couldn't replicate it myself. It's because I didn't describe the problem accurately. It's actually perfectly fine if you re-sort within the same column. I.e. sorting from 5 stars to 1 stars and back to 5 stars again stays the same, as expected.

However, if you have it sorted with 5 stars on top, then sort by description, then sort back to 5 stars on top... it's not the same as it was initially.

Interestingly enough (to me), if you sort AGAIN by description and then AGAIN by ranking... it goes back to the FIRST sorting order. And then if you sort by description yet again and then by ranking yet again... yep, it goes back to the second sorting order. So it really only seems to flip between two sets of orders of the list. Interesting! (From a code point, this will probably make perfect sense to you, I'm guessing, but from my end, it's... well, interesting!)

Screenshots attached, but hopefully with my new and improved description, you'll be able to replicate it for yourself and see what I mean. (And to be honest, this is another issue-my-wife-has-with-the-wishlist-that-bugs-the-heck-out-of-her-which-means-she-bugs-me-about-it issue.)

/Kevin

P.S. And for the sake of clarity, I should note that I don't have any five star items on my wishlist, so even though I mention sorting from "five stars" back to one star, it's really four stars in my case. So basically, high to low and back, etc.

On Mon, Feb 25, 2013 at 5:12 PM, Aaron Eiche notifications@github.comwrote:

Can you provide some screen shots of this behavior?

— Reply to this email directly or view it on GitHubhttps://github.com/aaroneiche/do-want/issues/43#issuecomment-14079358.

aaroneiche commented 11 years ago

Ahh - I think I'm clear on what's going on here.

The sorting is handled by a toggle event. Basically, you click it once and it sorts descending, click it again and it sorts ascending, click again, it switches back to sorting descending.

When you sort by another column, that doesn't affect the last toggled sort of the column you were previously sorting by. So if you sort by rank, it'll sort descending. and then sort by description sorting by rank again will cause it to flop over to rank sort by ascending.

It is fixable, but will require some rewriting. Right now it's tied to jQuery events.