convert transaction with = to normal but pass isSet=true

This commit is contained in:
Bel LaPointe
2023-10-25 11:25:38 -06:00
parent a4bf52d0e9
commit 0267819b45
2 changed files with 28 additions and 16 deletions

View File

@@ -14,6 +14,7 @@ type Delta struct {
Value float64
Currency Currency
Description string
isSet bool
}
func newDelta(d, desc, name string, v float64, c string) Delta {
@@ -36,5 +37,10 @@ func (delta Delta) Plus(other Delta) Delta {
}
func (delta Delta) Debug() string {
return fmt.Sprintf("{@%s %s:\"%s\" %.2f %s}", delta.Date, delta.Name, delta.Description, delta.Value, delta.Currency)
return fmt.Sprintf("{@%s %s:\"%s\" %s%.2f %s}", delta.Date, delta.Name, delta.Description, func() string {
if !delta.isSet {
return ""
}
return "= "
}(), delta.Value, delta.Currency)
}