Merge branch 'staging' into add-granblue-id-keys

This commit is contained in:
Justin Edmund 2023-03-16 08:31:35 -07:00
commit 7c49c66721
4 changed files with 21 additions and 5 deletions

View file

@ -185,7 +185,6 @@ module Api
def authorize def authorize
# Create # Create
ap @party
unauthorized_create = @party && (@party.user != current_user || @party.edit_key != edit_key) unauthorized_create = @party && (@party.user != current_user || @party.edit_key != edit_key)
unauthorized_update = @weapon && @weapon.party && (@weapon.party.user != current_user || @weapon.party.edit_key != edit_key) unauthorized_update = @weapon && @weapon.party && (@weapon.party.user != current_user || @weapon.party.edit_key != edit_key)

View file

@ -150,7 +150,7 @@ module Api
def mismatched_skill(job, skill) def mismatched_skill(job, skill)
mismatched_main = (skill.job.id != job.id) && skill.main && !skill.sub mismatched_main = (skill.job.id != job.id) && skill.main && !skill.sub
mismatched_emp = (skill.job.id != job.id) && skill.emp mismatched_emp = (skill.job.id != job.id && skill.job.base_job.id != job.base_job.id) && skill.emp
mismatched_base = skill.job.base_job && (job.row != 'ex2' || skill.job.base_job.id != job.base_job.id) && skill.base mismatched_base = skill.job.base_job && (job.row != 'ex2' || skill.job.base_job.id != job.base_job.id) && skill.base
if %w[4 5 ex2].include?(job.row) if %w[4 5 ex2].include?(job.row)

View file

@ -65,7 +65,7 @@ module Api
new_party.local_id = party_params[:local_id] if !party_params.nil? new_party.local_id = party_params[:local_id] if !party_params.nil?
if new_party.save if new_party.save
render json: PartyBlueprint.render(new_party, view: :full, root: :party, render json: PartyBlueprint.render(new_party, view: :created, root: :party,
meta: { remix: true }) meta: { remix: true })
else else
render_validation_error_response(new_party) render_validation_error_response(new_party)

View file

@ -140,17 +140,27 @@ module Api
# Perform the query # Perform the query
skills = if search_params[:query].present? && search_params[:query].length >= 2 skills = if search_params[:query].present? && search_params[:query].length >= 2
JobSkill.method("#{locale}_search").call(search_params[:query]) JobSkill.joins(:job)
.method("#{locale}_search").call(search_params[:query])
.where(conditions) .where(conditions)
.where(job: job.id, main: false) .where(job: job.id, main: false)
.or( .or(
JobSkill.method("#{locale}_search").call(search_params[:query]) JobSkill.joins(:job)
.method("#{locale}_search").call(search_params[:query])
.where(conditions) .where(conditions)
.where(sub: true) .where(sub: true)
.where.not(job: job.id) .where.not(job: job.id)
) )
.or(
JobSkill.joins(:job)
.method("#{locale}_search").call(search_params[:query])
.where(conditions)
.where(job: { base_job: job.base_job.id }, emp: true)
.where.not(job: job.id)
)
else else
JobSkill.all JobSkill.all
.joins(:job)
.where(conditions) .where(conditions)
.where(job: job.id, main: false) .where(job: job.id, main: false)
.or( .or(
@ -165,6 +175,13 @@ module Api
.where(job: job.base_job.id, base: true) .where(job: job.base_job.id, base: true)
.where.not(job: job.id) .where.not(job: job.id)
) )
.or(
JobSkill.all
.where(conditions)
.joins(:job)
.where(job: { base_job: job.base_job.id }, emp: true)
.where.not(job: job.id)
)
end end
count = skills.length count = skills.length