Merge branch 'main' into staging
This commit is contained in:
commit
e1fd895d1a
3 changed files with 20 additions and 4 deletions
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue