mirror of
https://github.com/celogeek/piwigo-cli.git
synced 2025-05-25 10:12: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 {
|
func (c *Categories) Names() []string {
|
||||||
names := []string{}
|
names := make([]string, len(*c))
|
||||||
for _, category := range *c {
|
for i, category := range *c {
|
||||||
names = append(names, category.Name)
|
names[i] = category.Name
|
||||||
}
|
}
|
||||||
return names
|
return names
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,13 @@ type Tag struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c Tags) NamesWithAgeAt(createdAt TimeResult) []string {
|
func (c Tags) NamesWithAgeAt(createdAt TimeResult) []string {
|
||||||
names := []string{}
|
names := make([]string, len(c))
|
||||||
for _, category := range c {
|
for i, category := range c {
|
||||||
bd := category.Birthdate.AgeAt(createdAt)
|
bd := category.Birthdate.AgeAt(createdAt)
|
||||||
if bd != "" {
|
if bd != "" {
|
||||||
names = append(names, fmt.Sprintf("%s (%s)", category.Name, bd))
|
names[i] = fmt.Sprintf("%s (%s)", category.Name, bd)
|
||||||
} else {
|
} else {
|
||||||
names = append(names, category.Name)
|
names[i] = category.Name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return names
|
return names
|
||||||
|
Loading…
x
Reference in New Issue
Block a user