mirror of
https://github.com/celogeek/piwigo-cli.git
synced 2025-05-25 02:02:37 +02:00
optimize
This commit is contained in:
parent
e86ab01766
commit
10c210a383
@ -10,9 +10,9 @@ type Category struct {
|
||||
}
|
||||
|
||||
func (c *Categories) Names() []string {
|
||||
names := []string{}
|
||||
for _, category := range *c {
|
||||
names = append(names, category.Name)
|
||||
names := make([]string, len(*c))
|
||||
for i, category := range *c {
|
||||
names[i] = category.Name
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
@ -17,13 +17,13 @@ type Tag struct {
|
||||
}
|
||||
|
||||
func (c Tags) NamesWithAgeAt(createdAt TimeResult) []string {
|
||||
names := []string{}
|
||||
for _, category := range c {
|
||||
names := make([]string, len(c))
|
||||
for i, category := range c {
|
||||
bd := category.Birthdate.AgeAt(createdAt)
|
||||
if bd != "" {
|
||||
names = append(names, fmt.Sprintf("%s (%s)", category.Name, bd))
|
||||
names[i] = fmt.Sprintf("%s (%s)", category.Name, bd)
|
||||
} else {
|
||||
names = append(names, category.Name)
|
||||
names[i] = category.Name
|
||||
}
|
||||
}
|
||||
return names
|
||||
|
Loading…
x
Reference in New Issue
Block a user