From 57e6e83ecd3de7c321b175978605acd93698e51d Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Tue, 13 Nov 2018 18:51:51 +0900 Subject: [PATCH] Updated MAL character sync --- jobs/mal-sync/mal-sync.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/jobs/mal-sync/mal-sync.go b/jobs/mal-sync/mal-sync.go index 0784ac4a..8bb827ae 100644 --- a/jobs/mal-sync/mal-sync.go +++ b/jobs/mal-sync/mal-sync.go @@ -100,12 +100,18 @@ func syncCharacter(character *arn.Character, malID string) { character.Name.Japanese = malCharacter.JapaneseName } - // Unless it's a manually created or edited character, - // update the description. - if character.CreatedBy == "" && character.EditedBy == "" { - description, attributes := parseCharacterDescription(malCharacter.Description) + if character.Name.Canonical == "" && malCharacter.Name != "" { character.Name.Canonical = malCharacter.Name + } + + allowUpdating := character.CreatedBy == "" && character.EditedBy == "" + description, attributes := parseCharacterDescription(malCharacter.Description) + + if (allowUpdating || character.Description == "") && description != "" { character.Description = description + } + + if allowUpdating { character.Attributes = attributes character.Spoilers = []arn.Spoiler{}