This commit is contained in:
bel
2023-10-25 16:49:15 -06:00
parent bc9da905a7
commit 8d8be105a9

View File

@@ -28,23 +28,35 @@ func RegisterWithContributionPrediction(reg map[string]Balances, windowAsPercent
}() }()
log.Print(datesToPredict) log.Print(datesToPredict)
namesDatesContributions := func() map[string]map[string]Balances { namesDatesBalance := func() map[string]map[string]Balance {
panic("todo") result := make(map[string]map[string]Balance)
for date, balances := range reg {
for name, balance := range balances {
if _, ok := result[name]; !ok {
result[name] = make(map[string]Balance)
}
result[name][date] = balance
}
}
return result
}() }()
result := make(map[string]Balances) result := make(map[string]Balances)
for name, datesContributions := range namesDatesContributions { for name, datesBalance := range namesDatesBalance {
result[name] = func() Balances { result[name] = func() Balances {
dates := func() []string { dates := func() []string {
result := make([]string, 0) result := make([]string, 0)
for k := range datesContributions { for k := range datesBalance {
result = append(result, k) result = append(result, k)
} }
return result return result
}() }()
slices.Sort(dates) slices.Sort(dates)
//var half, threeQuarter, sevenEighths string half := dates[len(dates)/2]
panic(fmt.Sprint(name, dates)) threeQuarter := dates[int(3.0*(len(dates)/4.0))]
sevenEighths := dates[int(7.0*(len(dates)/8.0))]
sum:= func(start, stop string) balance
panic(fmt.Sprintf("%s: %s .. %s .. %s (%v)", name, half, threeQuarter, sevenEighths, dates))
}() }()
} }
return result, nil return result, nil