i am so pleased
This commit is contained in:
@@ -39,9 +39,26 @@ func NewInterestPredictor(namePattern string, currencyPattern string, apy float6
|
||||
|
||||
func NewContributionPredictor(reg ledger.Register) Predictor {
|
||||
monthlyRate := getMonthlyContributionRates(reg)
|
||||
_ = monthlyRate
|
||||
return newContributionPredictor(monthlyRate)
|
||||
}
|
||||
|
||||
func newContributionPredictor(monthlyRate map[string]ledger.Balance) Predictor {
|
||||
return func(given ledger.Balances, delta time.Duration) ledger.Balances {
|
||||
panic(nil)
|
||||
month := time.Hour * 24 * 365 / 12
|
||||
months := float64(delta) / float64(month)
|
||||
result := make(ledger.Balances)
|
||||
for k, v := range given {
|
||||
result[k] = maps.Clone(v)
|
||||
}
|
||||
for name := range monthlyRate {
|
||||
if _, ok := result[name]; !ok {
|
||||
result[name] = make(ledger.Balance)
|
||||
}
|
||||
for currency := range monthlyRate[name] {
|
||||
result[name][currency] += monthlyRate[name][currency] * months
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user