diff --git a/app/controllers/api/v1/characters_controller.rb b/app/controllers/api/v1/characters_controller.rb index 810bfca..44545b0 100644 --- a/app/controllers/api/v1/characters_controller.rb +++ b/app/controllers/api/v1/characters_controller.rb @@ -226,7 +226,7 @@ module Api params.require(:character).permit( :granblue_id, :name_en, :name_jp, :rarity, :element, :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_atk, :max_atk, :max_atk_flb, :max_atk_ulb, :base_da, :base_ta, :ougi_ratio, :ougi_ratio_flb, diff --git a/app/controllers/api/v1/search_controller.rb b/app/controllers/api/v1/search_controller.rb index 708a13d..e4339ed 100644 --- a/app/controllers/api/v1/search_controller.rb +++ b/app/controllers/api/v1/search_controller.rb @@ -70,7 +70,6 @@ module Api filters['proficiency2'] end conditions[:season] = filters['season'] unless filters['season'].blank? || filters['season'].empty? - conditions[:gacha_available] = filters['gacha_available'] unless filters['gacha_available'].nil? end characters = if search_params[:query].present? && search_params[:query].length >= 2 diff --git a/app/controllers/api/v1/weapons_controller.rb b/app/controllers/api/v1/weapons_controller.rb index 2dac231..8ed8dfb 100644 --- a/app/controllers/api/v1/weapons_controller.rb +++ b/app/controllers/api/v1/weapons_controller.rb @@ -216,7 +216,7 @@ module Api def weapon_params params.require(:weapon).permit( :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_atk, :max_atk, :max_atk_flb, :max_atk_ulb, :max_level, :max_skill_level, :max_awakening_level, diff --git a/app/models/character.rb b/app/models/character.rb index 3d47110..2d051a4 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -44,14 +44,6 @@ class Character < ApplicationRecord { slug: 'character-multi', name_en: 'Multiattack', name_jp: '連続攻撃', order: 3 } ].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 validates :season, @@ -64,8 +56,6 @@ class Character < ApplicationRecord # Scopes scope :by_season, ->(season) { where(season: season) } 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]]) } def blueprint @@ -81,10 +71,6 @@ class Character < ApplicationRecord season.present? && season != GranblueEnums::CHARACTER_SEASONS[:Standard] end - def gachable? - gacha_available - end - def season_name return nil if season.nil? diff --git a/db/migrate/20251215122402_move_gacha_from_characters_to_weapons.rb b/db/migrate/20251215122402_move_gacha_from_characters_to_weapons.rb new file mode 100644 index 0000000..c51d86d --- /dev/null +++ b/db/migrate/20251215122402_move_gacha_from_characters_to_weapons.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index cf321d7..38b3cb3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -134,8 +134,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_15_173625) do t.text "game_raw_en_backup" t.integer "season" 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 ["name_en"], name: "index_characters_on_name_en", opclass: :gin_trgm_ops, using: :gin 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.integer "promotions", default: [], null: false, array: true 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 ["name_en"], name: "index_weapons_on_name_en", opclass: :gin_trgm_ops, using: :gin t.index ["promotions"], name: "index_weapons_on_promotions", using: :gin