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

@@ -5,7 +5,7 @@
<tr>
<th scope="col"></th>
<th scope="col"><%= t('wow_characters.character_list.name') %></th>
<th scope="col"><%= t('wow_characters.character_list.gender') %></th>
<th scope="col"><%= t('wow_characters.character_list.guild') %></th>
<th scope="col"><%= t('wow_characters.character_list.realm') %></th>
<th scope="col"><%= t('wow_characters.character_list.race') %></th>
<th scope="col"><%= t('wow_characters.character_list.class') %></th>
@@ -20,7 +20,7 @@
<img class="rounded-circle border border-white" src=<%= character.wow_character_medium.avatar %> alt="avatar">
<% end %></td>
<td><%= link_to character.name, character %></td>
<td><%= character.translated_gender %></td>
<td><%= character.wow_guild&.name %></td>
<td><%= character.wow_realm.name %></td>
<td><%= gender_race_name(character.gender, character.wow_race) %></td>
<td><%= gender_class_name(character.gender, character.wow_class) %></td>

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

View File

@@ -1,7 +1,7 @@
# frozen_string_literal: true
class WowItemsWorker < WowSidekiqWorker
def perform(item_id, batch_size)
def perform(item_id, batch_size, keep_going_on)
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
RBattlenet.set_options(locale: 'all')
@@ -43,8 +43,10 @@ class WowItemsWorker < WowSidekiqWorker
wow_item.save
end
# Create a new job for the next batch
WowItemsWorker.perform_async(result.results.last.data.id + 1, batch_size) unless result.results.count.zero?
# Create a new job for the next batch if keep_going_on is true
return unless keep_going_on && !result.results.count.zero?
WowItemsWorker.perform_async(result.results.last.data.id + 1, batch_size, keep_going_on)
end
private

View File

@@ -8,3 +8,4 @@ de-de:
class: "Klasse"
faction: "Fraktion"
level: "Niveau"
guild: "Gilde"

View File

@@ -8,3 +8,4 @@ en-gb:
class: "Class"
faction: "Faction"
level: "Level"
guild: "Guild"

View File

@@ -8,3 +8,4 @@ en-us:
class: "Class"
faction: "Faction"
level: "Level"
guild: "Guild"

View File

@@ -8,3 +8,4 @@ es-es:
class: "Clase"
faction: "Facción"
level: "Nivel"
guild: "Gremio"

View File

@@ -8,3 +8,4 @@ es-mx:
class: "Clase"
faction: "Facción"
level: "Nivel"
guild: "Gremio"

View File

@@ -8,3 +8,4 @@ fr-fr:
class: "Classe"
faction: "Faction"
level: "Niveau"
guild: "Guilde"

View File

@@ -8,3 +8,4 @@ it:
class: "Classe"
faction: "Fazione"
level: "Livello"
guild: "Gilda"

View File

@@ -8,3 +8,4 @@ ko:
class: "수업"
faction: "파벌"
level: "수평"
guild: "동업 조합"

View File

@@ -8,3 +8,4 @@ pt-br:
class: "Classe"
faction: "Facção"
level: "Nível"
guild: "Guilda"

View File

@@ -8,3 +8,4 @@ ru-ru:
class: "Учебный класс"
faction: "Фракция"
level: "Уровень"
guild: "Гильдия"

View File

@@ -8,3 +8,4 @@ zh-cn:
class: "类"
faction: "派"
level: "水平"
guild: "公会"

View File

@@ -8,3 +8,4 @@ zh-tw:
class: "类"
faction: "派"
level: "水平"
guild: "公会"