inline return else

This commit is contained in:
Ruidy 2024-03-03 20:47:12 +01:00
parent 761719f1bf
commit a7514e9419
No known key found for this signature in database
GPG key ID: E00F51288CB857CC

View file

@ -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)) 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" { if l.Platform == "Other" {
f = l.Total * 5 / 100 return l.Total * 5 / 100
} else {
f = l.Total * 10 / 100
} }
return f return l.Total * 10 / 100
} }
func (l Line) Profit() float64 { 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 { BookingFees: u.Reduce(lines, func(l *Line, sum float64) float64 {
if l.Platform == "Booking" { if l.Platform == "Booking" {
return sum + l.PlatformFees return sum + l.PlatformFees
} else {
return sum
} }
return sum
}, 0.0), }, 0.0),
} }
} }