move gacha from characters to weapons
weapons have gacha boolean now, characters don't
This commit is contained in:
parent
d54af86dc1
commit
056aa3676f
6 changed files with 17 additions and 19 deletions
|
|
@ -226,7 +226,7 @@ module Api
|
||||||
params.require(:character).permit(
|
params.require(:character).permit(
|
||||||
:granblue_id, :name_en, :name_jp, :rarity, :element,
|
:granblue_id, :name_en, :name_jp, :rarity, :element,
|
||||||
:proficiency1, :proficiency2, :gender, :race1, :race2,
|
:proficiency1, :proficiency2, :gender, :race1, :race2,
|
||||||
:flb, :ulb, :special, :season, :gacha_available,
|
:flb, :ulb, :special, :season,
|
||||||
:min_hp, :max_hp, :max_hp_flb, :max_hp_ulb,
|
:min_hp, :max_hp, :max_hp_flb, :max_hp_ulb,
|
||||||
:min_atk, :max_atk, :max_atk_flb, :max_atk_ulb,
|
:min_atk, :max_atk, :max_atk_flb, :max_atk_ulb,
|
||||||
:base_da, :base_ta, :ougi_ratio, :ougi_ratio_flb,
|
:base_da, :base_ta, :ougi_ratio, :ougi_ratio_flb,
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ module Api
|
||||||
filters['proficiency2']
|
filters['proficiency2']
|
||||||
end
|
end
|
||||||
conditions[:season] = filters['season'] unless filters['season'].blank? || filters['season'].empty?
|
conditions[:season] = filters['season'] unless filters['season'].blank? || filters['season'].empty?
|
||||||
conditions[:gacha_available] = filters['gacha_available'] unless filters['gacha_available'].nil?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
characters = if search_params[:query].present? && search_params[:query].length >= 2
|
characters = if search_params[:query].present? && search_params[:query].length >= 2
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ module Api
|
||||||
def weapon_params
|
def weapon_params
|
||||||
params.require(:weapon).permit(
|
params.require(:weapon).permit(
|
||||||
:granblue_id, :name_en, :name_jp, :rarity, :element, :proficiency, :series, :new_series,
|
:granblue_id, :name_en, :name_jp, :rarity, :element, :proficiency, :series, :new_series,
|
||||||
:flb, :ulb, :transcendence, :extra, :limit, :ax,
|
:flb, :ulb, :transcendence, :extra, :limit, :ax, :gacha,
|
||||||
:min_hp, :max_hp, :max_hp_flb, :max_hp_ulb,
|
:min_hp, :max_hp, :max_hp_flb, :max_hp_ulb,
|
||||||
:min_atk, :max_atk, :max_atk_flb, :max_atk_ulb,
|
:min_atk, :max_atk, :max_atk_flb, :max_atk_ulb,
|
||||||
:max_level, :max_skill_level, :max_awakening_level,
|
:max_level, :max_skill_level, :max_awakening_level,
|
||||||
|
|
|
||||||
|
|
@ -44,14 +44,6 @@ class Character < ApplicationRecord
|
||||||
{ slug: 'character-multi', name_en: 'Multiattack', name_jp: '連続攻撃', order: 3 }
|
{ slug: 'character-multi', name_en: 'Multiattack', name_jp: '連続攻撃', order: 3 }
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
# Non-gachable series (characters that must be recruited, not pulled)
|
|
||||||
NON_GACHABLE_SERIES = [
|
|
||||||
GranblueEnums::CHARACTER_SERIES[:Eternal],
|
|
||||||
GranblueEnums::CHARACTER_SERIES[:Evoker],
|
|
||||||
GranblueEnums::CHARACTER_SERIES[:Saint],
|
|
||||||
GranblueEnums::CHARACTER_SERIES[:Event],
|
|
||||||
GranblueEnums::CHARACTER_SERIES[:Collab]
|
|
||||||
].freeze
|
|
||||||
|
|
||||||
# Validations
|
# Validations
|
||||||
validates :season,
|
validates :season,
|
||||||
|
|
@ -64,8 +56,6 @@ class Character < ApplicationRecord
|
||||||
# Scopes
|
# Scopes
|
||||||
scope :by_season, ->(season) { where(season: season) }
|
scope :by_season, ->(season) { where(season: season) }
|
||||||
scope :by_series, ->(series) { where('? = ANY(series)', series) }
|
scope :by_series, ->(series) { where('? = ANY(series)', series) }
|
||||||
scope :gachable, -> { where(gacha_available: true) }
|
|
||||||
scope :recruitable, -> { where(gacha_available: false) }
|
|
||||||
scope :seasonal, -> { where.not(season: [nil, GranblueEnums::CHARACTER_SEASONS[:Standard]]) }
|
scope :seasonal, -> { where.not(season: [nil, GranblueEnums::CHARACTER_SEASONS[:Standard]]) }
|
||||||
|
|
||||||
def blueprint
|
def blueprint
|
||||||
|
|
@ -81,10 +71,6 @@ class Character < ApplicationRecord
|
||||||
season.present? && season != GranblueEnums::CHARACTER_SEASONS[:Standard]
|
season.present? && season != GranblueEnums::CHARACTER_SEASONS[:Standard]
|
||||||
end
|
end
|
||||||
|
|
||||||
def gachable?
|
|
||||||
gacha_available
|
|
||||||
end
|
|
||||||
|
|
||||||
def season_name
|
def season_name
|
||||||
return nil if season.nil?
|
return nil if season.nil?
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class MoveGachaFromCharactersToWeapons < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
# Add gacha boolean to weapons table
|
||||||
|
add_column :weapons, :gacha, :boolean, default: false, null: false
|
||||||
|
add_index :weapons, :gacha
|
||||||
|
|
||||||
|
# Remove gacha_available from characters table
|
||||||
|
remove_index :characters, :gacha_available
|
||||||
|
remove_column :characters, :gacha_available, :boolean, default: true, null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -134,8 +134,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_15_173625) do
|
||||||
t.text "game_raw_en_backup"
|
t.text "game_raw_en_backup"
|
||||||
t.integer "season"
|
t.integer "season"
|
||||||
t.integer "series", default: [], null: false, array: true
|
t.integer "series", default: [], null: false, array: true
|
||||||
t.boolean "gacha_available", default: true, null: false
|
|
||||||
t.index ["gacha_available"], name: "index_characters_on_gacha_available"
|
|
||||||
t.index ["granblue_id"], name: "index_characters_on_granblue_id"
|
t.index ["granblue_id"], name: "index_characters_on_granblue_id"
|
||||||
t.index ["name_en"], name: "index_characters_on_name_en", opclass: :gin_trgm_ops, using: :gin
|
t.index ["name_en"], name: "index_characters_on_name_en", opclass: :gin_trgm_ops, using: :gin
|
||||||
t.index ["season"], name: "index_characters_on_season"
|
t.index ["season"], name: "index_characters_on_season"
|
||||||
|
|
@ -975,6 +973,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_15_173625) do
|
||||||
t.jsonb "game_raw_jp", comment: "JSON data from game (Japanese)"
|
t.jsonb "game_raw_jp", comment: "JSON data from game (Japanese)"
|
||||||
t.integer "promotions", default: [], null: false, array: true
|
t.integer "promotions", default: [], null: false, array: true
|
||||||
t.uuid "weapon_series_id"
|
t.uuid "weapon_series_id"
|
||||||
|
t.boolean "gacha", default: false, null: false
|
||||||
|
t.index ["gacha"], name: "index_weapons_on_gacha"
|
||||||
t.index ["granblue_id"], name: "index_weapons_on_granblue_id"
|
t.index ["granblue_id"], name: "index_weapons_on_granblue_id"
|
||||||
t.index ["name_en"], name: "index_weapons_on_name_en", opclass: :gin_trgm_ops, using: :gin
|
t.index ["name_en"], name: "index_weapons_on_name_en", opclass: :gin_trgm_ops, using: :gin
|
||||||
t.index ["promotions"], name: "index_weapons_on_promotions", using: :gin
|
t.index ["promotions"], name: "index_weapons_on_promotions", using: :gin
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue