Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
fix #74: fix bug with unexpected domain rate unit
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsk committed Nov 25, 2018
1 parent 0ec10d0 commit 753de64
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/transport/grpc/rpc/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ func Timestamp(tp *time.Time) *timestamp.Timestamp {
func convertFromDomainContract(from domain.Contract) *protobuf.Contract {
to := &protobuf.Contract{Requests: from.Requests, Workplaces: from.Workplaces}
to.Since, to.Until = Timestamp(from.Since), Timestamp(from.Until)
value, unit := from.Rate.Value()
to.Rate = &protobuf.Rate{Value: value, Unit: units.convert(domain.RateUnit(unit))}
if !from.Rate.IsEmpty() {
value, unit := from.Rate.Value()
to.Rate = &protobuf.Rate{Value: value, Unit: units.convert(domain.RateUnit(unit))}
}
return to
}

Expand Down

0 comments on commit 753de64

Please sign in to comment.