implement O(n**2) analyzer.go:Analyzer:Add mvp
parent
5a64552d91
commit
c023f5bbfc
|
|
@ -8,7 +8,17 @@ type Analyzer struct {
|
||||||
|
|
||||||
// Add adds unique transactions to Analyzer.
|
// Add adds unique transactions to Analyzer.
|
||||||
func (anz *Analyzer) Add(transactions Transactions) int {
|
func (anz *Analyzer) Add(transactions Transactions) int {
|
||||||
anz.transactions = append(anz.transactions, transactions...)
|
for i := range transactions {
|
||||||
|
dupe := false
|
||||||
|
for j := range anz.transactions {
|
||||||
|
if transactions[i] == anz.transactions[j] {
|
||||||
|
dupe = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !dupe {
|
||||||
|
anz.transactions = append(anz.transactions, transactions[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
return len(transactions)
|
return len(transactions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
25
todo.yaml
25
todo.yaml
|
|
@ -19,6 +19,11 @@ todo:
|
||||||
or latest?
|
or latest?
|
||||||
- analyzer.go:Analyzer:Add should dedupe transactions added, but transactions.go:FromFile
|
- analyzer.go:Analyzer:Add should dedupe transactions added, but transactions.go:FromFile
|
||||||
will load duplicate transactions from json file so hmmmm
|
will load duplicate transactions from json file so hmmmm
|
||||||
|
- analyzer.go:Analzyer:Add dedupes each transaction, which is O(n**2) to compare
|
||||||
|
each input with each existing entry
|
||||||
|
- analyzer.go:Analyzer:Add dedupes but what is a duplicate transaction? Transactions
|
||||||
|
can be pending and then later disappear to have their date updated OR be like
|
||||||
|
pre-charges on credit cards that later disappear
|
||||||
scheduled: []
|
scheduled: []
|
||||||
done:
|
done:
|
||||||
- todo: hello world
|
- todo: hello world
|
||||||
|
|
@ -508,3 +513,23 @@ done:
|
||||||
- analyzer.go:Analyzer:LargestTransaction doesn't specify how to break ties; stable
|
- analyzer.go:Analyzer:LargestTransaction doesn't specify how to break ties; stable
|
||||||
or latest?
|
or latest?
|
||||||
ts: Sun Oct 15 11:40:52 MDT 2023
|
ts: Sun Oct 15 11:40:52 MDT 2023
|
||||||
|
- todo: go test
|
||||||
|
subtasks:
|
||||||
|
- TestAnalyzer_DuplicatesExcluded
|
||||||
|
- TestAnalyzer_GroupByCategory
|
||||||
|
- TestAnalyzer_BigSpendersReport
|
||||||
|
- TestAnalyzer_TransactionsFromURLs
|
||||||
|
- TestAnalyzer_TransactionsFromURLsConcurrent
|
||||||
|
- amount.go:Rounded probably does NOT handle float precision well... it is float64
|
||||||
|
tho...
|
||||||
|
- my `go mod tidy` actually cleared `go.mod` file, probably weird localhost backwards
|
||||||
|
compatilble stuff
|
||||||
|
- transaction.go:Transaction:String not clear if FormatUSD or amount currency should
|
||||||
|
not be changed, or even what currency Amount is
|
||||||
|
- transaction.go:Transaction:Sum again doesnt care about Amount currency or vendor/vendee
|
||||||
|
drift
|
||||||
|
- analyzer.go:Analyzer:LargestTransaction doesn't specify how to break ties; stable
|
||||||
|
or latest?
|
||||||
|
- analyzer.go:Analyzer:Add should dedupe transactions added, but transactions.go:FromFile
|
||||||
|
will load duplicate transactions from json file so hmmmm
|
||||||
|
ts: Sun Oct 15 11:44:18 MDT 2023
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue