add achievement management
This commit is contained in:
6
app/models/completed_wow_achievement.rb
Normal file
6
app/models/completed_wow_achievement.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class CompletedWowAchievement < ApplicationRecord
|
||||||
|
belongs_to :wow_character
|
||||||
|
belongs_to :wow_achievement
|
||||||
|
end
|
||||||
6
app/models/completed_wow_achievement_criterium.rb
Normal file
6
app/models/completed_wow_achievement_criterium.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class CompletedWowAchievementCriterium < ApplicationRecord
|
||||||
|
belongs_to :wow_character
|
||||||
|
belongs_to :wow_achievement_criterium
|
||||||
|
end
|
||||||
22
app/models/wow_achievement.rb
Normal file
22
app/models/wow_achievement.rb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class WowAchievement < ApplicationRecord
|
||||||
|
extend Mobility
|
||||||
|
translates :name, :description, :reward_description
|
||||||
|
|
||||||
|
belongs_to :wow_achievement_category, optional: true
|
||||||
|
belongs_to :wow_achievement_criterium, optional: true
|
||||||
|
|
||||||
|
belongs_to :prerequisite_achievement, class_name: 'WowAchievement', optional: true
|
||||||
|
has_one :next_achievement,
|
||||||
|
class_name: 'WowAchievement',
|
||||||
|
foreign_key: 'prerequisite_achievement_id',
|
||||||
|
dependent: :nullify,
|
||||||
|
inverse_of: :prerequisite_achievement
|
||||||
|
|
||||||
|
has_many :completed_wow_achievements, dependent: :destroy
|
||||||
|
has_many :wow_characters, through: :completed_wow_achievements
|
||||||
|
|
||||||
|
validates :name, presence: true
|
||||||
|
validates :achievement_id, presence: true, uniqueness: true
|
||||||
|
end
|
||||||
11
app/models/wow_achievement_category.rb
Normal file
11
app/models/wow_achievement_category.rb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class WowAchievementCategory < ApplicationRecord
|
||||||
|
extend Mobility
|
||||||
|
translates :name
|
||||||
|
|
||||||
|
has_many :wow_achievements, dependent: :destroy
|
||||||
|
|
||||||
|
validates :name, presence: true
|
||||||
|
validates :category_id, presence: true, uniqueness: true
|
||||||
|
end
|
||||||
18
app/models/wow_achievement_criterium.rb
Normal file
18
app/models/wow_achievement_criterium.rb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class WowAchievementCriterium < ApplicationRecord
|
||||||
|
extend Mobility
|
||||||
|
translates :description, :operator_name
|
||||||
|
|
||||||
|
has_many :wow_achievements, dependent: :destroy
|
||||||
|
has_many :child_criteria,
|
||||||
|
class_name: 'WowAchievementCriterium',
|
||||||
|
foreign_key: 'parent_criterium_id',
|
||||||
|
dependent: :destroy,
|
||||||
|
inverse_of: :parent_criterium
|
||||||
|
belongs_to :parent_criterium, class_name: 'WowAchievementCriterium', optional: true
|
||||||
|
has_many :completed_wow_achievement_criteria, dependent: :destroy
|
||||||
|
has_many :wow_characters, through: :completed_wow_achievement_criteria
|
||||||
|
|
||||||
|
validates :criterium_id, presence: true, uniqueness: true
|
||||||
|
end
|
||||||
@@ -19,6 +19,10 @@ class WowCharacter < ApplicationRecord
|
|||||||
has_many :wow_reputations, through: :wow_standings
|
has_many :wow_reputations, through: :wow_standings
|
||||||
has_many :wow_character_play_rp_worlds, dependent: :destroy
|
has_many :wow_character_play_rp_worlds, dependent: :destroy
|
||||||
has_many :rp_worlds, through: :wow_character_play_rp_worlds
|
has_many :rp_worlds, through: :wow_character_play_rp_worlds
|
||||||
|
has_many :completed_wow_achievements, dependent: :destroy
|
||||||
|
has_many :wow_achievements, through: :completed_wow_achievements
|
||||||
|
has_many :completed_wow_achievement_criteria, dependent: :destroy
|
||||||
|
has_many :wow_achievement_criteria, through: :completed_wow_achievement_criteria
|
||||||
|
|
||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
validates :character_id, presence: true, uniqueness: true
|
validates :character_id, presence: true, uniqueness: true
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<h1>Editing Rp World</h1>
|
<h1>Editing Rp World</h1>
|
||||||
|
|
||||||
<%= render 'form', rp_world: @rp_world %>
|
<%= turbo_frame_tag "rp_world" do %>
|
||||||
|
<%= render 'form', rp_world: @rp_world %>
|
||||||
|
|
||||||
<%= link_to 'Show', @rp_world %> |
|
<%= link_to 'Show', @rp_world %> |
|
||||||
<%= link_to 'Back', rp_worlds_path %>
|
<%= link_to 'Back', rp_worlds_path, data: { "turbo-frame": "_top" } %>
|
||||||
|
<% end %>
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
<%= turbo_frame_tag "rp_world" do %>
|
||||||
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title"><%= @rp_world.name %></h5>
|
<h5 class="card-title"><%= @rp_world.name %></h5>
|
||||||
<p class="card-text">Description: <%= @rp_world.description %></p>
|
<p class="card-text">Description: <%= @rp_world.description %></p>
|
||||||
<p>Membres: </p>
|
<p>Membres: </p>
|
||||||
<% @rp_world.wow_characters.each do |member| %>
|
<% @rp_world.wow_characters.each do |member| %>
|
||||||
<p><%= link_to member.name, member %></p>
|
<p><%= link_to member.name, member %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-7">
|
||||||
|
<h1>Suite...</h1>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-7">
|
|
||||||
<h1>Suite...</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= link_to 'Edit', edit_rp_world_path(@rp_world) %> |
|
<%= link_to 'Edit', edit_rp_world_path(@rp_world) %> |
|
||||||
<%= link_to 'Back', rp_worlds_path %>
|
<%= link_to 'Back', rp_worlds_path, data: { "turbo-frame": "_top" } %>
|
||||||
|
<% end %>
|
||||||
|
|||||||
22
app/workers/wow_achievement_categories_worker.rb
Normal file
22
app/workers/wow_achievement_categories_worker.rb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class WowAchievementCategoriesWorker < WowSidekiqWorker
|
||||||
|
def perform
|
||||||
|
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||||
|
RBattlenet.set_options(locale: 'all')
|
||||||
|
result = RBattlenet::Wow::AchievementCategory.all
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
result.categories.each do |category|
|
||||||
|
wow_category = WowAchievementCategory.find_or_initialize_by(category_id: category.id)
|
||||||
|
|
||||||
|
# Localisation data
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) { wow_category.name = category.name[locale[1]] }
|
||||||
|
end
|
||||||
|
|
||||||
|
wow_category.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
62
app/workers/wow_achievement_detail_worker.rb
Normal file
62
app/workers/wow_achievement_detail_worker.rb
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class WowAchievementDetailWorker < WowSidekiqWorker
|
||||||
|
def perform(wow_achievement_id)
|
||||||
|
return unless (wow_achievement = WowAchievement.find_by(achievement_id: wow_achievement_id))
|
||||||
|
|
||||||
|
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||||
|
RBattlenet.set_options(locale: 'all')
|
||||||
|
|
||||||
|
# Public data
|
||||||
|
result = RBattlenet::Wow::Achievement.find(wow_achievement_id)
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) do
|
||||||
|
wow_achievement.description = result.description[locale[1]]
|
||||||
|
wow_achievement.reward_description = result.reward_description[locale[1]] if result.reward_description
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
wow_achievement.points = result.points
|
||||||
|
wow_achievement.is_account_wide = result.is_account_wide
|
||||||
|
wow_achievement.display_order = result.display_order
|
||||||
|
wow_achievement.prerequisite_achievement = WowAchievement.find_by(achievement_id: result.prerequisite_achievement.id) if result.prerequisite_achievement
|
||||||
|
wow_achievement.wow_achievement_category = WowAchievementCategory.find_by(category_id: result.category.id) if result.category
|
||||||
|
wow_achievement.wow_achievement_criterium = find_or_create_wow_achievement_criterium(result.criteria) if result.criteria
|
||||||
|
wow_achievement.icon = RBattlenet::Wow::AchievementMedia.find(result.media.id).assets[0].value if result.media
|
||||||
|
|
||||||
|
wow_achievement.save
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_or_create_wow_achievement_criterium(criteria)
|
||||||
|
wow_achievement_criterium = WowAchievementCriterium.find_or_initialize_by(criterium_id: criteria.id)
|
||||||
|
|
||||||
|
wow_achievement_criterium.amount = criteria.amount
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) { wow_achievement_criterium.description = criteria.description[locale[1]] }
|
||||||
|
end
|
||||||
|
|
||||||
|
if criteria.operator
|
||||||
|
wow_achievement_criterium.operator_type = criteria.operator.type
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) { wow_achievement_criterium.operator_name = criteria.operator.name[locale[1]] }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
wow_achievement_criterium.save
|
||||||
|
|
||||||
|
criteria.child_criteria&.each do |child_criterium|
|
||||||
|
wow_child_achievement_criterium = WowAchievementCriterium.find_or_initialize_by(criterium_id: child_criterium.id)
|
||||||
|
wow_child_achievement_criterium.parent_criterium = wow_achievement_criterium
|
||||||
|
wow_child_achievement_criterium.amount = child_criterium.amount
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) { wow_child_achievement_criterium.description = child_criterium.description[locale[1]] }
|
||||||
|
end
|
||||||
|
wow_child_achievement_criterium.save
|
||||||
|
end
|
||||||
|
|
||||||
|
wow_achievement_criterium.persisted? ? wow_achievement_criterium : nil
|
||||||
|
end
|
||||||
|
end
|
||||||
24
app/workers/wow_achievements_worker.rb
Normal file
24
app/workers/wow_achievements_worker.rb
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class WowAchievementsWorker < WowSidekiqWorker
|
||||||
|
def perform
|
||||||
|
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||||
|
RBattlenet.set_options(locale: 'all')
|
||||||
|
result = RBattlenet::Wow::Achievement.all
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
result.achievements.each do |achievement|
|
||||||
|
wow_achievement = WowAchievement.find_or_initialize_by(achievement_id: achievement.id)
|
||||||
|
|
||||||
|
# Localisation data
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) { wow_achievement.name = achievement.name[locale[1]] }
|
||||||
|
end
|
||||||
|
|
||||||
|
wow_achievement.save
|
||||||
|
|
||||||
|
WowAchievementDetailWorker.perform_async(wow_achievement.achievement_id) if wow_achievement.persisted?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
54
app/workers/wow_character_achievements_worker.rb
Normal file
54
app/workers/wow_character_achievements_worker.rb
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class WowCharacterAchievementsWorker < WowSidekiqWorker
|
||||||
|
def perform(wow_character_id)
|
||||||
|
return unless (wow_character = WowCharacter.find_by(character_id: wow_character_id))
|
||||||
|
|
||||||
|
RBattlenet.set_options(locale: 'en_US')
|
||||||
|
params = { realm: wow_character.wow_realm.slug, name: wow_character.name.downcase }
|
||||||
|
result = RBattlenet::Wow::Character::Achievements.find(params)
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
result.achievements&.each do |achievement|
|
||||||
|
next unless (wow_achievement = WowAchievement.find_by(achievement_id: achievement.id))
|
||||||
|
|
||||||
|
wow_achievement_completed = CompletedWowAchievement.where(
|
||||||
|
wow_achievement: wow_achievement,
|
||||||
|
wow_character: wow_character
|
||||||
|
).first_or_initialize
|
||||||
|
|
||||||
|
wow_achievement_completed.completed_timestamp = Time.at(achievement.completed_timestamp.to_s[0..-4].to_i).utc
|
||||||
|
|
||||||
|
wow_achievement_completed.save
|
||||||
|
|
||||||
|
if achievement.criteria
|
||||||
|
next unless (wow_achievement_criterium = WowAchievementCriterium.find_by(criterium_id: achievement.criteria.id))
|
||||||
|
|
||||||
|
wow_achievement_criterium_completed = CompletedWowAchievementCriterium.where(
|
||||||
|
wow_achievement_criterium: wow_achievement_criterium,
|
||||||
|
wow_character: wow_character
|
||||||
|
).first_or_initialize
|
||||||
|
|
||||||
|
wow_achievement_criterium_completed.is_completed = achievement.criteria.is_completed
|
||||||
|
wow_achievement_criterium_completed.amount = achievement.criteria.amount if achievement.criteria.amount
|
||||||
|
|
||||||
|
wow_achievement_criterium_completed.save
|
||||||
|
|
||||||
|
achievement.criteria.child_criteria&.each do |child_criteria|
|
||||||
|
next unless (wow_achievement_child_criterium = WowAchievementCriterium.find_by(criterium_id: child_criteria.id))
|
||||||
|
|
||||||
|
wow_achievement_child_criterium_completed = CompletedWowAchievementCriterium.where(
|
||||||
|
wow_achievement_criterium: wow_achievement_child_criterium,
|
||||||
|
wow_character: wow_character
|
||||||
|
).first_or_initialize
|
||||||
|
|
||||||
|
wow_achievement_child_criterium_completed.is_completed = child_criteria.is_completed
|
||||||
|
wow_achievement_child_criterium_completed.amount = child_criteria.amount if child_criteria.amount
|
||||||
|
|
||||||
|
wow_achievement_child_criterium_completed.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,8 +10,8 @@ class WowCharactersWorker < WowSidekiqWorker
|
|||||||
|
|
||||||
return unless result.status_code == 200
|
return unless result.status_code == 200
|
||||||
|
|
||||||
result.wow_accounts.each do |account|
|
result.wow_accounts&.each do |account|
|
||||||
account.characters.each do |character|
|
account.characters&.each do |character|
|
||||||
wow_char = user.wow_characters.find_or_initialize_by(character_id: character.id)
|
wow_char = user.wow_characters.find_or_initialize_by(character_id: character.id)
|
||||||
|
|
||||||
wow_char.name = character.name
|
wow_char.name = character.name
|
||||||
@@ -19,9 +19,9 @@ class WowCharactersWorker < WowSidekiqWorker
|
|||||||
wow_char.faction = character.faction.type
|
wow_char.faction = character.faction.type
|
||||||
wow_char.href = character.character.href
|
wow_char.href = character.character.href
|
||||||
wow_char.level = character.level
|
wow_char.level = character.level
|
||||||
wow_char.wow_realm = WowRealm.where(realm_id: character.realm.id).first
|
wow_char.wow_realm = WowRealm.find_by(realm_id: character.realm.id)
|
||||||
wow_char.wow_class = WowClass.where(class_id: character.playable_class.id).first
|
wow_char.wow_class = WowClass.find_by(class_id: character.playable_class.id)
|
||||||
wow_char.wow_race = WowRace.where(race_id: character.playable_race.id).first
|
wow_char.wow_race = WowRace.find_by(race_id: character.playable_race.id)
|
||||||
wow_char.user = user
|
wow_char.user = user
|
||||||
wow_char.account_id = account.id
|
wow_char.account_id = account.id
|
||||||
|
|
||||||
@@ -40,6 +40,7 @@ class WowCharactersWorker < WowSidekiqWorker
|
|||||||
WowCharacterDetailWorker.perform_async(wow_char.character_id)
|
WowCharacterDetailWorker.perform_async(wow_char.character_id)
|
||||||
WowCharacterPositionsWorker.perform_async(wow_char.character_id)
|
WowCharacterPositionsWorker.perform_async(wow_char.character_id)
|
||||||
WowStandingWorker.perform_async(wow_char.character_id)
|
WowStandingWorker.perform_async(wow_char.character_id)
|
||||||
|
WowCharacterAchievementsWorker.perform_async(wow_char.character_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
class CreateWowAchievementCategories < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
create_table :wow_achievement_categories do |t|
|
||||||
|
t.integer :category_id, null: false
|
||||||
|
t.jsonb :name
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :wow_achievement_categories, :category_id, unique: true
|
||||||
|
end
|
||||||
|
end
|
||||||
13
db/migrate/20210814100232_create_wow_achievement_criteria.rb
Normal file
13
db/migrate/20210814100232_create_wow_achievement_criteria.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
class CreateWowAchievementCriteria < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
create_table :wow_achievement_criteria do |t|
|
||||||
|
t.integer :criterium_id, null: false
|
||||||
|
t.jsonb :description
|
||||||
|
t.integer :amount
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :wow_achievement_criteria, :criterium_id, unique: true
|
||||||
|
end
|
||||||
|
end
|
||||||
21
db/migrate/20210814100509_create_wow_achievements.rb
Normal file
21
db/migrate/20210814100509_create_wow_achievements.rb
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
class CreateWowAchievements < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
create_table :wow_achievements do |t|
|
||||||
|
t.integer :achievement_id, null: false
|
||||||
|
t.jsonb :name
|
||||||
|
t.jsonb :description
|
||||||
|
t.integer :points
|
||||||
|
t.boolean :is_account_wide
|
||||||
|
t.integer :display_order
|
||||||
|
t.string :icon
|
||||||
|
t.belongs_to :wow_achievement_category
|
||||||
|
t.belongs_to :wow_achievement_criterium
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :wow_achievements, :achievement_id, unique: true
|
||||||
|
|
||||||
|
add_reference :wow_achievements, :prerequisite_achievement, foreign_key: { to_table: :wow_achievements }
|
||||||
|
end
|
||||||
|
end
|
||||||
5
db/migrate/20210815101616_add_wow_criterium_self_join.rb
Normal file
5
db/migrate/20210815101616_add_wow_criterium_self_join.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class AddWowCriteriumSelfJoin < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
add_reference :wow_achievement_criteria, :parent_criterium, foreign_key: { to_table: :wow_achievement_criteria }
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
class AddOperatorToWowCriterium < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
add_column :wow_achievement_criteria, :operator_name, :jsonb
|
||||||
|
add_column :wow_achievement_criteria, :operator_type, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddRewardDescriptionToWowAchievement < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
add_column :wow_achievements, :reward_description, :jsonb
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
class CreateCompletedWowAchievements < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
create_table :completed_wow_achievements do |t|
|
||||||
|
t.datetime :completed_timestamp
|
||||||
|
t.belongs_to :wow_character
|
||||||
|
t.belongs_to :wow_achievement
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
class CreateCompletedWowAchievementCriteria < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
create_table :completed_wow_achievement_criteria do |t|
|
||||||
|
t.integer :amount
|
||||||
|
t.boolean :is_completed
|
||||||
|
t.belongs_to :wow_character
|
||||||
|
t.bigint "wow_achievement_criterium_id"
|
||||||
|
t.index ["wow_achievement_criterium_id"], name: "completed_achievement_criteria_on_achievement_criterium_id"
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
66
db/schema.rb
generated
66
db/schema.rb
generated
@@ -10,11 +10,32 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2021_06_02_193023) do
|
ActiveRecord::Schema.define(version: 2021_08_15_130405) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
|
create_table "completed_wow_achievement_criteria", force: :cascade do |t|
|
||||||
|
t.integer "amount"
|
||||||
|
t.boolean "is_completed"
|
||||||
|
t.bigint "wow_character_id"
|
||||||
|
t.bigint "wow_achievement_criterium_id"
|
||||||
|
t.datetime "created_at", precision: 6, null: false
|
||||||
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
|
t.index ["wow_achievement_criterium_id"], name: "completed_achievement_criteria_on_achievement_criterium_id"
|
||||||
|
t.index ["wow_character_id"], name: "index_completed_wow_achievement_criteria_on_wow_character_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "completed_wow_achievements", force: :cascade do |t|
|
||||||
|
t.datetime "completed_timestamp"
|
||||||
|
t.bigint "wow_character_id"
|
||||||
|
t.bigint "wow_achievement_id"
|
||||||
|
t.datetime "created_at", precision: 6, null: false
|
||||||
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
|
t.index ["wow_achievement_id"], name: "index_completed_wow_achievements_on_wow_achievement_id"
|
||||||
|
t.index ["wow_character_id"], name: "index_completed_wow_achievements_on_wow_character_id"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "learned_wow_pet_abilities", force: :cascade do |t|
|
create_table "learned_wow_pet_abilities", force: :cascade do |t|
|
||||||
t.bigint "wow_pet_id"
|
t.bigint "wow_pet_id"
|
||||||
t.bigint "wow_pet_ability_id"
|
t.bigint "wow_pet_ability_id"
|
||||||
@@ -92,6 +113,47 @@ ActiveRecord::Schema.define(version: 2021_06_02_193023) do
|
|||||||
t.index ["battletag"], name: "index_users_on_battletag", unique: true
|
t.index ["battletag"], name: "index_users_on_battletag", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "wow_achievement_categories", force: :cascade do |t|
|
||||||
|
t.integer "category_id", null: false
|
||||||
|
t.jsonb "name"
|
||||||
|
t.datetime "created_at", precision: 6, null: false
|
||||||
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
|
t.index ["category_id"], name: "index_wow_achievement_categories_on_category_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "wow_achievement_criteria", force: :cascade do |t|
|
||||||
|
t.integer "criterium_id", null: false
|
||||||
|
t.jsonb "description"
|
||||||
|
t.integer "amount"
|
||||||
|
t.datetime "created_at", precision: 6, null: false
|
||||||
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
|
t.bigint "parent_criterium_id"
|
||||||
|
t.jsonb "operator_name"
|
||||||
|
t.string "operator_type"
|
||||||
|
t.index ["criterium_id"], name: "index_wow_achievement_criteria_on_criterium_id", unique: true
|
||||||
|
t.index ["parent_criterium_id"], name: "index_wow_achievement_criteria_on_parent_criterium_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "wow_achievements", force: :cascade do |t|
|
||||||
|
t.integer "achievement_id", null: false
|
||||||
|
t.jsonb "name"
|
||||||
|
t.jsonb "description"
|
||||||
|
t.integer "points"
|
||||||
|
t.boolean "is_account_wide"
|
||||||
|
t.integer "display_order"
|
||||||
|
t.string "icon"
|
||||||
|
t.bigint "wow_achievement_category_id"
|
||||||
|
t.bigint "wow_achievement_criterium_id"
|
||||||
|
t.datetime "created_at", precision: 6, null: false
|
||||||
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
|
t.bigint "prerequisite_achievement_id"
|
||||||
|
t.jsonb "reward_description"
|
||||||
|
t.index ["achievement_id"], name: "index_wow_achievements_on_achievement_id", unique: true
|
||||||
|
t.index ["prerequisite_achievement_id"], name: "index_wow_achievements_on_prerequisite_achievement_id"
|
||||||
|
t.index ["wow_achievement_category_id"], name: "index_wow_achievements_on_wow_achievement_category_id"
|
||||||
|
t.index ["wow_achievement_criterium_id"], name: "index_wow_achievements_on_wow_achievement_criterium_id"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "wow_character_media", force: :cascade do |t|
|
create_table "wow_character_media", force: :cascade do |t|
|
||||||
t.bigint "wow_character_id"
|
t.bigint "wow_character_id"
|
||||||
t.string "avatar"
|
t.string "avatar"
|
||||||
@@ -469,6 +531,8 @@ ActiveRecord::Schema.define(version: 2021_06_02_193023) do
|
|||||||
t.index ["wow_reputation_id"], name: "index_wow_standings_on_wow_reputation_id"
|
t.index ["wow_reputation_id"], name: "index_wow_standings_on_wow_reputation_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_foreign_key "wow_achievement_criteria", "wow_achievement_criteria", column: "parent_criterium_id"
|
||||||
|
add_foreign_key "wow_achievements", "wow_achievements", column: "prerequisite_achievement_id"
|
||||||
add_foreign_key "wow_characters", "wow_geo_positions", column: "bind_position_id"
|
add_foreign_key "wow_characters", "wow_geo_positions", column: "bind_position_id"
|
||||||
add_foreign_key "wow_characters", "wow_geo_positions", column: "last_position_id"
|
add_foreign_key "wow_characters", "wow_geo_positions", column: "last_position_id"
|
||||||
add_foreign_key "wow_reputations", "wow_reputations", column: "meta_wow_reputation_id"
|
add_foreign_key "wow_reputations", "wow_reputations", column: "meta_wow_reputation_id"
|
||||||
|
|||||||
5
spec/models/completed_wow_achievement_criterium_spec.rb
Normal file
5
spec/models/completed_wow_achievement_criterium_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe CompletedWowAchievementCriterium, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
5
spec/models/completed_wow_achievement_spec.rb
Normal file
5
spec/models/completed_wow_achievement_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe CompletedWowAchievement, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
5
spec/models/wow_achievement_category_spec.rb
Normal file
5
spec/models/wow_achievement_category_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe WowAchievementCategory, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
5
spec/models/wow_achievement_criterium_spec.rb
Normal file
5
spec/models/wow_achievement_criterium_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe WowAchievementCriterium, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
5
spec/models/wow_achievement_spec.rb
Normal file
5
spec/models/wow_achievement_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe WowAchievement, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user