From a7514e941908ddc30c277be9eb83bf53b8eccea3 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sun, 3 Mar 2024 20:47:12 +0100 Subject: [PATCH] inline return else --- internal/booking/service.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/internal/booking/service.go b/internal/booking/service.go index ad39128..911f471 100644 --- a/internal/booking/service.go +++ b/internal/booking/service.go @@ -92,13 +92,11 @@ func (l Line) InvoiceNumber(hc *config.Host) string { return fmt.Sprintf("%s%04s", hc.InvoicePrefix, strconv.Itoa(l.Id+hc.CustomerSeed)) } -func (l Line) Fee() (f float64) { +func (l Line) Fee() float64 { if l.Platform == "Other" { - f = l.Total * 5 / 100 - } else { - f = l.Total * 10 / 100 + return l.Total * 5 / 100 } - return f + return l.Total * 10 / 100 } func (l Line) Profit() float64 { @@ -152,9 +150,8 @@ func (bs Service) BuildReport(period string, month, year int) *Report { BookingFees: u.Reduce(lines, func(l *Line, sum float64) float64 { if l.Platform == "Booking" { return sum + l.PlatformFees - } else { - return sum } + return sum }, 0.0), } }