code simplification
This commit is contained in:
parent
be80307bde
commit
cf2e217030
7 changed files with 47 additions and 73 deletions
|
|
@ -1,7 +1,7 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
|
@ -49,15 +49,7 @@ func (s SpecialCake) Detail() string {
|
|||
if len(parts) == 0 {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("(%s)", joinParts(parts))
|
||||
}
|
||||
|
||||
func joinParts(parts []string) string {
|
||||
out := parts[0]
|
||||
for i := 1; i < len(parts); i++ {
|
||||
out += ", " + parts[i]
|
||||
}
|
||||
return out
|
||||
return "(" + strings.Join(parts, ", ") + ")"
|
||||
}
|
||||
|
||||
type Order struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue