Hotfix 20230821 (#127)
* Fix favorites page by fixing how query is built * Set uncap level when GridSummon is created If you don't, then NULL entries get sent to the database from the bookmarklet.
This commit is contained in:
parent
ac7f5ab80a
commit
c79d2717cc
1 changed files with 15 additions and 9 deletions
|
|
@ -14,6 +14,7 @@ module Api
|
||||||
# Create the GridSummon with the desired parameters
|
# Create the GridSummon with the desired parameters
|
||||||
summon = GridSummon.new
|
summon = GridSummon.new
|
||||||
summon.attributes = summon_params.merge(party_id: party.id, summon_id: incoming_summon.id)
|
summon.attributes = summon_params.merge(party_id: party.id, summon_id: incoming_summon.id)
|
||||||
|
summon.uncap_level = max_uncap_level(summon) if summon.uncap_level.nil?
|
||||||
|
|
||||||
if summon.validate
|
if summon.validate
|
||||||
save_summon(summon)
|
save_summon(summon)
|
||||||
|
|
@ -32,15 +33,7 @@ module Api
|
||||||
|
|
||||||
def update_uncap_level
|
def update_uncap_level
|
||||||
summon = @summon.summon
|
summon = @summon.summon
|
||||||
max_uncap_level = if summon.flb && !summon.ulb && !summon.xlb
|
max_uncap_level = max_uncap_level(summon)
|
||||||
4
|
|
||||||
elsif summon.ulb && !summon.xlb
|
|
||||||
5
|
|
||||||
elsif summon.xlb
|
|
||||||
6
|
|
||||||
else
|
|
||||||
3
|
|
||||||
end
|
|
||||||
|
|
||||||
greater_than_max_uncap = summon_params[:uncap_level].to_i > max_uncap_level
|
greater_than_max_uncap = summon_params[:uncap_level].to_i > max_uncap_level
|
||||||
can_be_transcended = summon.xlb && summon_params[:transcendence_step] && summon_params[:transcendence_step]&.to_i&.positive?
|
can_be_transcended = summon.xlb && summon_params[:transcendence_step] && summon_params[:transcendence_step]&.to_i&.positive?
|
||||||
|
|
@ -120,6 +113,19 @@ module Api
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def max_uncap_level(summon)
|
||||||
|
object = summon.summon
|
||||||
|
if object.flb && !object.ulb && !object.xlb
|
||||||
|
4
|
||||||
|
elsif object.ulb && !object.xlb
|
||||||
|
5
|
||||||
|
elsif object.xlb
|
||||||
|
6
|
||||||
|
else
|
||||||
|
3
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def find_incoming_summon
|
def find_incoming_summon
|
||||||
@incoming_summon = Summon.find_by(id: summon_params[:summon_id])
|
@incoming_summon = Summon.find_by(id: summon_params[:summon_id])
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue