newDelta accepts isSet
parent
cd38f0669f
commit
b1deb29575
|
|
@ -17,13 +17,14 @@ type Delta struct {
|
||||||
isSet bool
|
isSet bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDelta(d, desc, name string, v float64, c string) Delta {
|
func newDelta(d, desc, name string, v float64, c string, isSet bool) Delta {
|
||||||
return Delta{
|
return Delta{
|
||||||
Date: d,
|
Date: d,
|
||||||
Name: name,
|
Name: name,
|
||||||
Value: v,
|
Value: v,
|
||||||
Currency: Currency(c),
|
Currency: Currency(c),
|
||||||
Description: desc,
|
Description: desc,
|
||||||
|
isSet: isSet,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
|
|
||||||
func TestDelta(t *testing.T) {
|
func TestDelta(t *testing.T) {
|
||||||
d := "2099-08-07"
|
d := "2099-08-07"
|
||||||
delta := newDelta(d, "", "name", 34.56, "$")
|
delta := newDelta(d, "", "name", 34.56, "$", false)
|
||||||
|
|
||||||
if delta.Date != d {
|
if delta.Date != d {
|
||||||
t.Error(delta.Date)
|
t.Error(delta.Date)
|
||||||
|
|
@ -23,7 +23,7 @@ func TestDelta(t *testing.T) {
|
||||||
t.Log(delta)
|
t.Log(delta)
|
||||||
|
|
||||||
d2 := "2099-09-08"
|
d2 := "2099-09-08"
|
||||||
delta2 := newDelta(d2, "", "name", 11.11, "$")
|
delta2 := newDelta(d2, "", "name", 11.11, "$", false)
|
||||||
|
|
||||||
combined := delta.Plus(delta2)
|
combined := delta.Plus(delta2)
|
||||||
if combined.Date != d2 {
|
if combined.Date != d2 {
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ func (files Files) Deltas(like ...Like) (Deltas, error) {
|
||||||
recipient.name,
|
recipient.name,
|
||||||
recipient.value,
|
recipient.value,
|
||||||
recipient.currency,
|
recipient.currency,
|
||||||
|
recipient.isSet,
|
||||||
)
|
)
|
||||||
result = append(result, delta)
|
result = append(result, delta)
|
||||||
}
|
}
|
||||||
|
|
@ -121,6 +122,7 @@ func (files Files) Deltas(like ...Like) (Deltas, error) {
|
||||||
transaction.payee,
|
transaction.payee,
|
||||||
-1.0*value,
|
-1.0*value,
|
||||||
currency,
|
currency,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
result = append(result, delta)
|
result = append(result, delta)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue