jamis / bucketwise

ATTENTION: This project is no longer being updated. If you're still interested, feel free to read on... "A web-based personal finance manager with a focus on non-OCD budgeting and avoiding credit card debt"
http://wiki.github.com/jamis/bucketwise
Other
457 stars 82 forks source link

Sorting by occurred_on/id is more logical than occurred_on/updated_at #18

Open KieranP opened 15 years ago

KieranP commented 15 years ago

When someone edits an item that was made on the same date as another item, it gets repositioned higher in the list.

For people who want to structure their data, to compare against bank accounts, it becomes tricky when they edit an item.

http://github.com/KieranP/bucketwise/commit/3821ab2d362d6156e8644aa60dfdcdbd785291fe

Using that patch, it sorts by occurred_on, and then by id, to maintain the order people add items.

jamis commented 15 years ago

I'm always uncomfortable with sorting by id, since it's not formally defined as being a monotonically increasing value. I think it might be better to sort events by (occurred_on, created_at), since created_at has, by definition, an order defined for it.

Also, the sql-nazi in me is cringing, slightly, at the thought of performing a query like that without having the full sort criteria in the index. Given, though, that the number of events having the same occurred_on value will be small, it's probably going to fine without including created_at (or id, if you can convince me).

KieranP commented 15 years ago

Sure, created_at sounds like a better column to sort by. Not sure what you mean by "without having the full sort criteria in the index", however the number of events on the same day is not small. Using a joint account, I can see upward of 15 or more sometimes and when it comes to compare with bank accounts, its a hassle if the bottom is at the top is at the top because I edited it.

Any you could always provide an options of switching between sorting by creation, and sorting by updated at if you want to maintain the current functionality.