31 lines
508 B
Go
Raw Normal View History

2018-03-23 02:37:14 +00:00
package filteranime
import (
"github.com/aerogo/aero"
2019-06-03 09:32:43 +00:00
"github.com/animenotifier/notify.moe/arn"
2018-03-23 02:37:14 +00:00
)
// DuplicateMappings ...
2019-06-01 04:55:49 +00:00
func DuplicateMappings(ctx aero.Context) error {
2018-03-23 02:37:14 +00:00
return editorList(
ctx,
"Anime with duplicate mappings",
func(anime *arn.Anime) bool {
existing := map[string]bool{}
2018-03-23 02:37:14 +00:00
for _, mapping := range anime.Mappings {
_, exists := existing[mapping.Service]
2018-03-23 02:37:14 +00:00
if exists {
return true
}
existing[mapping.Service] = true
2018-03-23 02:37:14 +00:00
}
return false
},
nil,
)
}