Skip to content

Commit

Permalink
Merge pull request #1181 from AlphaWallet/fix-order-transactions-tab-…
Browse files Browse the repository at this point in the history
…reversed

Fix: Order of transactions in tab within each day is displayed in reverse
  • Loading branch information
bitcoinwarrior1 authored Apr 14, 2019
2 parents 3e871a4 + 1c31935 commit c6ff422
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions AlphaWallet/Tokens/Types/TransactionCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ class TransactionCollection {

var objects: [Transaction] {
var transactions = [Transaction]()
//Concatenate arrays of hundreds/thousands of elements and then sort them. Room for speed improvement, but it seems good enough so far. It'll be much more efficient if we do a single read from Realm directly and sort with Realm
//Concatenate arrays of hundreds/thousands of elements. Room for speed improvement, but it seems good enough so far. It'll be much more efficient if we do a single read from Realm directly
for each in transactionsStorages {
transactions.append(contentsOf: Array(each.objects))
}
transactions.sort { $0.date < $1.date }
return transactions
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct TransactionsViewModel {
newItems[date] = currentItems
}
//TODO. IMPROVE perfomance
let tuple = newItems.map { (key, values) in return (date: key, transactions: values) }
let tuple = newItems.map { (key, values) in return (date: key, transactions: values.sorted { $0.date > $1.date }) }
items = tuple.sorted { (object1, object2) -> Bool in
return formatter.date(from: object1.date)! > formatter.date(from: object2.date)!
}
Expand Down

0 comments on commit c6ff422

Please sign in to comment.