Update uncap level endpoints to use uncap view
- Change response view from :nested/:full to :uncap for update_uncap_level - Add default value of 0 for transcendence_step when not provided - Fix max_uncap_level method call in GridSummonsController
This commit is contained in:
parent
f66e4d5a48
commit
7a1e2fc8f9
3 changed files with 6 additions and 6 deletions
|
|
@ -82,12 +82,12 @@ module Api
|
|||
# @return [void]
|
||||
def update_uncap_level
|
||||
@grid_character.uncap_level = character_params[:uncap_level]
|
||||
@grid_character.transcendence_step = character_params[:transcendence_step]
|
||||
@grid_character.transcendence_step = character_params[:transcendence_step] || 0
|
||||
|
||||
if @grid_character.save
|
||||
render json: GridCharacterBlueprint.render(@grid_character,
|
||||
root: :grid_character,
|
||||
view: :nested)
|
||||
view: :uncap)
|
||||
else
|
||||
render_validation_error_response(@grid_character)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ module Api
|
|||
# Then, using `tap`, ensure that the uncap_level is set by using the max_uncap_level helper
|
||||
# if it hasn't already been provided.
|
||||
grid_summon = build_grid_summon.tap do |gs|
|
||||
gs.uncap_level ||= max_uncap_level(gs)
|
||||
gs.uncap_level ||= max_uncap_level(gs.summon)
|
||||
end
|
||||
|
||||
# If the grid summon is valid (i.e. it passes all validations), then save it normally.
|
||||
|
|
@ -84,7 +84,7 @@ module Api
|
|||
new_transcendence_step = summon.transcendence && summon_params[:transcendence_step].present? ? summon_params[:transcendence_step] : 0
|
||||
|
||||
if @grid_summon.update(uncap_level: new_uncap_level, transcendence_step: new_transcendence_step)
|
||||
render json: GridSummonBlueprint.render(@grid_summon, view: :nested, root: :grid_summon)
|
||||
render json: GridSummonBlueprint.render(@grid_summon, view: :uncap, root: :grid_summon)
|
||||
else
|
||||
render_validation_error_response(@grid_summon)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ module Api
|
|||
requested_uncap = weapon_params[:uncap_level].to_i
|
||||
new_uncap = requested_uncap > max_uncap ? max_uncap : requested_uncap
|
||||
|
||||
if @grid_weapon.update(uncap_level: new_uncap, transcendence_step: weapon_params[:transcendence_step].to_i)
|
||||
render json: GridWeaponBlueprint.render(@grid_weapon, view: :full, root: :grid_weapon), status: :ok
|
||||
if @grid_weapon.update(uncap_level: new_uncap, transcendence_step: (weapon_params[:transcendence_step] || 0).to_i)
|
||||
render json: GridWeaponBlueprint.render(@grid_weapon, view: :uncap, root: :grid_weapon), status: :ok
|
||||
else
|
||||
render_validation_error_response(@grid_weapon)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue