From 4bc2b7055e851e83e575f5e046578767f4676e0a Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 20 Dec 2025 19:47:17 -0800 Subject: [PATCH] add canonical uncap data to roster endpoint --- app/controllers/api/v1/crews_controller.rb | 24 +++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/app/controllers/api/v1/crews_controller.rb b/app/controllers/api/v1/crews_controller.rb index 0509ecf..4a2d2ea 100644 --- a/app/controllers/api/v1/crews_controller.rb +++ b/app/controllers/api/v1/crews_controller.rb @@ -141,16 +141,30 @@ module Api return [] if ids.blank? collection = case type - when :characters then user.collection_characters.where(character_id: ids) - when :weapons then user.collection_weapons.where(weapon_id: ids) - when :summons then user.collection_summons.where(summon_id: ids) + when :characters then user.collection_characters.includes(:character).where(character_id: ids) + when :weapons then user.collection_weapons.includes(:weapon).where(weapon_id: ids) + when :summons then user.collection_summons.includes(:summon).where(summon_id: ids) end collection.map do |item| - { + canonical = case type + when :characters then item.character + when :weapons then item.weapon + when :summons then item.summon + end + + result = { id: item_id_for(item, type), - uncap_level: item.uncap_level + uncap_level: item.uncap_level, + transcendence_step: item.transcendence_step, + flb: canonical&.flb, + ulb: canonical&.ulb, + transcendence: canonical&.transcendence } + + result[:special] = canonical&.special if type == :characters + + result end end