Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Silvio Böhler committed Jan 5, 2022
1 parent 17ed685 commit 01ca778
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/common/amounts/amounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ func (am Amounts) Clone() Amounts {
}

// Minus mutably subtracts.
func (am Amounts) Minus(a Amounts) {
func (am Amounts) Minus(a Amounts) Amounts {
for ca, v := range a {
am[ca] = am[ca].Sub(v)
}
return am
}
3 changes: 1 addition & 2 deletions lib/journal/process/differ.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ func (pf Differ) ProcessStream(ctx context.Context, inCh <-chan *val.Day) (<-cha
if init {
res := &val.Day{
Date: d.Date,
Values: d.Values.Clone(),
Values: d.Values.Clone().Minus(v),
}
res.Values.Minus(v)
if push(ctx, resCh, res) != nil {
return
}
Expand Down

0 comments on commit 01ca778

Please sign in to comment.