diff --git a/digits-work-sample-go.d/transaction.go b/digits-work-sample-go.d/transaction.go index dee1f46..1cbbe15 100644 --- a/digits-work-sample-go.d/transaction.go +++ b/digits-work-sample-go.d/transaction.go @@ -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. diff --git a/todo.yaml b/todo.yaml index 8fd05eb..982a922 100755 --- a/todo.yaml +++ b/todo.yaml @@ -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