implement transaction.go:Transactions:Sum as blind sum of .Amount

main
bel 2023-10-15 11:28:15 -06:00
parent 58405fcdd8
commit 55422bb8af
2 changed files with 23 additions and 2 deletions

View File

@ -48,8 +48,11 @@ type Transactions []Transaction
// Sum adds all transactions together.
func (trns Transactions) Sum() Amount {
// TODO: Not implemented.
return 0.0
result := Amount(0.0)
for i := range trns {
result += trns[i].Amount
}
return result
}
// Count is the number of unique Transactions.

View File

@ -15,6 +15,8 @@ todo:
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
scheduled: []
done:
- todo: hello world
@ -416,3 +418,19 @@ done:
- my `go mod tidy` actually cleared `go.mod` file, probably weird localhost backwards
compatilble stuff
ts: Sun Oct 15 11:24:56 MDT 2023
- todo: go test
subtasks:
- TestAnalyzer_TransctionsSum
- TestAnalyzer_LargestTransaction
- 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
ts: Sun Oct 15 11:27:47 MDT 2023