whatif complete
parent
be555abbe8
commit
641ebf1c93
|
|
@ -75,7 +75,7 @@
|
|||
|
||||
<span>
|
||||
<label for="whatIf">whatIf</label>
|
||||
<input name="whatIf" type="text" value="AssetAccount:Cash $ -1.00"/>
|
||||
<input name="whatIf" type="text" value="AssetAccount:Cash $ -.10000"/>
|
||||
</span>
|
||||
|
||||
<span>
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ func main() {
|
|||
names = append(names, name)
|
||||
}
|
||||
}
|
||||
instant := map[string]string{}
|
||||
toChart := func(cumulative bool, display string, reg ledger.Register) Chart {
|
||||
nameCurrencyDateValue := map[string]map[ledger.Currency]map[string]float64{}
|
||||
for date, balances := range reg {
|
||||
|
|
@ -229,12 +230,14 @@ func main() {
|
|||
}
|
||||
series[i] = int(lastValue)
|
||||
}
|
||||
key := fmt.Sprintf("%s (%s)", name, currency)
|
||||
for i := range dates {
|
||||
if !(reg.Dates()[0] <= dates[i] && dates[i] <= reg.Dates()[len(reg.Dates())-1]) {
|
||||
series[i] = 0
|
||||
} else {
|
||||
instant[key] = fmt.Sprintf("@%s %v", dates[i], series[i])
|
||||
}
|
||||
}
|
||||
key := fmt.Sprintf("%s (%s)", name, currency)
|
||||
if slices.Min(series) != 0 || slices.Max(series) != 0 {
|
||||
chart.AddY(key, series)
|
||||
}
|
||||
|
|
@ -262,12 +265,14 @@ func main() {
|
|||
break
|
||||
}
|
||||
}
|
||||
key := fmt.Sprintf("%s (%s)", name, currency)
|
||||
for i := range dates {
|
||||
if !(reg.Dates()[0] <= dates[i] && dates[i] <= reg.Dates()[len(reg.Dates())-1]) {
|
||||
series[i] = 0
|
||||
} else {
|
||||
instant[key] = fmt.Sprintf("@%s %v", dates[i], series[i])
|
||||
}
|
||||
}
|
||||
key := fmt.Sprintf("%s (%s)", name, currency)
|
||||
if slices.Min(series) != 0 || slices.Max(series) != 0 {
|
||||
chart.AddY(key, series)
|
||||
}
|
||||
|
|
@ -283,6 +288,9 @@ func main() {
|
|||
if err := primary.Render(w); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for k, v := range instant {
|
||||
fmt.Fprintf(w, "<br>\n%s = %s", k, v)
|
||||
}
|
||||
}
|
||||
|
||||
log.Println("listening on", *httpOutput)
|
||||
|
|
|
|||
Loading…
Reference in New Issue