Skip to content

Commit

Permalink
[history] refs #295 Update only transactions not listed
Browse files Browse the repository at this point in the history
  • Loading branch information
stdevMac committed Jan 7, 2020
1 parent 249df23 commit 0f7e3d9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/models/history/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,19 @@ func (hm *TransactionList) data(index *core.QModelIndex, role int) *core.QVarian
func (hm *TransactionList) addMultipleTransactions(txns []*transactions.TransactionDetails) {

for _, txn := range txns {
hm.addTransaction(txn)
if !hm.txnContained(txn) {
hm.addTransaction(txn)
}
}
}

func (hm *TransactionList)txnContained(txn *transactions.TransactionDetails) bool {
for _, txnStored := range hm.Transactions() {
if txn.TransactionID() == txnStored.TransactionID() {
return true
}
}
return false
}

func (hm *TransactionList) clear() {
Expand Down
15 changes: 15 additions & 0 deletions src/ui/PageHistory.qml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,19 @@ Page {
modelTransactions.clear()
modelTransactions.addMultipleTransactions(historyManager.loadHistory())
}

property Timer timer: Timer{
id: historyTimer
repeat: true
running: true
interval: 4000
onTriggered: {
if (switchFilters.checked) {
modelTransactions.addMultipleTransactions(historyManager.loadHistoryWithFilters())
} else {
modelTransactions.addMultipleTransactions(historyManager.loadHistory())
}
}

}
}

0 comments on commit 0f7e3d9

Please sign in to comment.