Set extra from raid party, not extra property (#137)

This commit is contained in:
Justin Edmund 2023-11-05 14:30:08 -08:00 committed by GitHub
parent 3356701671
commit 92f29dfa08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,6 +23,11 @@ module Api
party.user = current_user if current_user party.user = current_user if current_user
party.attributes = party_params if party_params party.attributes = party_params if party_params
if party_params && party_params[:raid_id]
raid = Raid.find_by(id: party_params[:raid_id])
party.extra = raid.group.extra
end
if party.save! if party.save!
return render json: PartyBlueprint.render(party, view: :created, root: :party), return render json: PartyBlueprint.render(party, view: :created, root: :party),
status: :created status: :created
@ -45,6 +50,11 @@ module Api
def update def update
@party.attributes = party_params.except(:skill1_id, :skill2_id, :skill3_id) @party.attributes = party_params.except(:skill1_id, :skill2_id, :skill3_id)
if party_params && party_params[:raid_id]
raid = Raid.find_by(id: party_params[:raid_id])
@party.extra = raid.group.extra
end
# TODO: Validate accessory with job # TODO: Validate accessory with job
return render json: PartyBlueprint.render(@party, view: :full, root: :party) if @party.save return render json: PartyBlueprint.render(@party, view: :full, root: :party) if @party.save