BPI GET
This commit is contained in:
1
cmd/clitest/bpi.dat
Symbolic link
1
cmd/clitest/bpi.dat
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../../../../Sync/Core/ledger/bpi.dat
|
||||||
@@ -25,6 +25,7 @@ func main() {
|
|||||||
likeLedger := flag.Bool("like-ledger", false, "limit data to these -like-* rather than zoom to these -like-*")
|
likeLedger := flag.Bool("like-ledger", false, "limit data to these -like-* rather than zoom to these -like-*")
|
||||||
groupName := flag.String("group-name", ".*", "grouping to apply to names")
|
groupName := flag.String("group-name", ".*", "grouping to apply to names")
|
||||||
groupDate := flag.String("group-date", ".*", "grouping to apply to dates")
|
groupDate := flag.String("group-date", ".*", "grouping to apply to dates")
|
||||||
|
bpiPath := flag.String("bpi", "/dev/null", "bpi file")
|
||||||
jsonOutput := flag.Bool("json", false, "json output")
|
jsonOutput := flag.Bool("json", false, "json output")
|
||||||
httpOutput := flag.String("http", "", "http output listen address, like :8080")
|
httpOutput := flag.String("http", "", "http output listen address, like :8080")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
@@ -44,6 +45,14 @@ func main() {
|
|||||||
|
|
||||||
deltas = deltas.Group(ledger.GroupName(*groupName), ledger.GroupDate(*groupDate))
|
deltas = deltas.Group(ledger.GroupName(*groupName), ledger.GroupDate(*groupDate))
|
||||||
|
|
||||||
|
bpis := make(ledger.BPIs)
|
||||||
|
if *bpiPath != "" {
|
||||||
|
bpis, err = ledger.NewBPIs(*bpiPath)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
like := ledger.Likes{ledger.LikeName(*likeName)}
|
like := ledger.Likes{ledger.LikeName(*likeName)}
|
||||||
|
|
||||||
if *httpOutput != "" {
|
if *httpOutput != "" {
|
||||||
@@ -66,10 +75,14 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
register := deltas.Like(foolike...).Register()
|
register := deltas.Like(foolike...).Register()
|
||||||
|
|
||||||
nameCurrencyDateValue := map[string]map[ledger.Currency]map[string]float64{}
|
nameCurrencyDateValue := map[string]map[ledger.Currency]map[string]float64{}
|
||||||
dates := []string{}
|
dates := []string{}
|
||||||
for date, balances := range register {
|
for date, balances := range register {
|
||||||
dates = append(dates, date)
|
dates = append(dates, date)
|
||||||
|
if r.URL.Query().Get("bpi") != "" {
|
||||||
|
balances = balances.WithBPIs(bpis)
|
||||||
|
}
|
||||||
for name, balance := range balances {
|
for name, balance := range balances {
|
||||||
for currency, value := range balance {
|
for currency, value := range balance {
|
||||||
if _, ok := nameCurrencyDateValue[name]; !ok {
|
if _, ok := nameCurrencyDateValue[name]; !ok {
|
||||||
|
|||||||
Reference in New Issue
Block a user