Hey! We'll have some Ember deprecation fixes going out to production likely early next week (the PR just passed QA). In the accounts controller, we are no longer using the sortable mixin.
The properties model and arrangedContent are being removed.
The property visibleTransactionDisplayItems will be the list of transactions from the shared library and contentResults is the transactions after they have been sorted and filtered.
It looks like running-balance may be using those properties and likely elsewhere uses them too. So I wanted to give you all a heads up of the incoming changes.
Thanks!
@shama you're so awesome. Thanks for the heads up. I'll look into he running balance feature and make sure I refactor it to not use arrangedContent the only other feature that might be affected is search...
@shama Is there any array that's going to contain the full list of already sorted content? That was the great thing about arrangedContent. Since you guys already sorted it, I didn't have to do any extra sorting on my end. It looks like visibleTransactionDisplayItems is just a pointer to the unsorted accountsController.get('content').
If there's no array of fully sorted transactions, I guess I'm only left with doing the sort myself but of course, this isn't super ideal.
Thanks!
@joshmadewell contentResults will be the sorted and filtered list of transactions. Let me know if that will work. The release with that change should be going out in about an hour.
@shama, currently contentResults is the sorted and filtered list but also only this "visible" content on the page (so if there are 600 transactions on the account, contentResults is only ~38 transactions) are you saying that that's changing and contentResults will be the entire array of transaction sorted and filtered?
If that's the case, that's awesome but I think it would not be good to use because I need the full array to properly determine running balance. If I'm missing a few transactions because of a filter then the calculation would be off.
@joshmadewell Ah right. I guess you'll need to use visibleTransactionDisplayItems and sort it on your own to build that calculation. Here is the code we're using to sort the transactions:
visibleTransactionDisplayItems.sort(function (a, b) {
var propA = a.get(sortProperties[0])
var propB = b.get(sortProperties[0])
if (propA instanceof ynab.utilities.DateWithoutTime) propA = propA.getUTCTime()
if (propB instanceof ynab.utilities.DateWithoutTime) propB = propB.getUTCTime()
var res = Ember.compare(propA, propB)
if (res === 0) {
return Ember.compare(a.getAmount(), b.getAmount())
} else if (!sortAscending) {
return -res
} else {
return res
}
})
Hopefully someday we'll have a public API and all this will be much easier :)
@shama You are the most incredible person right now. When I rewrote using content I had an issue where I couldn't figure out the exact sorting you guys were using so somethings didn't match perfectly.
Also, if you guys need someone to help you making that API, I know someone that might want to help ;)
When you do release an API I'm going to have a hayday making it easy to enter transactions across the web. :-)
Anyway, looks like this is all fixed, so I'm going to go ahead and close this issue.
Most helpful comment
@joshmadewell Ah right. I guess you'll need to use
visibleTransactionDisplayItemsand sort it on your own to build that calculation. Here is the code we're using to sort the transactions:Hopefully someday we'll have a public API and all this will be much easier :)