update character page

This commit is contained in:
2021-05-30 13:58:36 +02:00
parent f4f3862c74
commit 6ed5be10df
15 changed files with 26 additions and 15 deletions

View File

@@ -27,16 +27,13 @@ class WowCharacterDetailWorker < WowSidekiqWorker
end
def find_or_create_wow_guild(guild)
WowGuild.find_by(guild_id: guild.id)
rescue ActiveRecord::RecordNotFound
return unless (wow_realm = WowRealm.find_by(realm_id: guild.realm.id))
wow_guild = WowGuild.find_or_initialize_by(guild_id: guild.id)
wow_guild = WowGuild.create(
guild_id: guild.id,
name: guild.name,
wow_relam: wow_realm
)
WowGuildDetailWorker.perform_async(wow_guild.guild_id)
wow_guild
wow_guild.name = guild.name
wow_guild.wow_realm = WowRealm.find_by(realm_id: guild.realm.id)
wow_guild.save
wow_guild.persisted? ? wow_guild : nil
end
end