Fix build_conditions method

The method of assigning values was assigning nil if the value wasn't present in `params`, which is bad
This commit is contained in:
Justin Edmund 2022-12-21 16:20:00 -08:00
parent 5b37e480f8
commit af51869927

View file

@ -55,6 +55,7 @@ module Api
def index
conditions = build_conditions(request.params)
ap conditions
@parties = Party.where(conditions)
.order(created_at: :desc)
@ -105,12 +106,12 @@ module Api
.to_datetime.beginning_of_day
end
{
element: (params['element'] unless params['element'].blank?),
raid: (params['raid'] unless params['raid'].blank?),
created_at: (start_time..now unless params['recency'].blank?),
weapons_count: 5..13
}
{}.tap do |hash|
hash[:element] = params['element'] unless params['element'].blank?
hash[:raid] = params['raid'] unless params['raid'].blank?
hash[:created_at] = start_time..now unless params['recency'].blank?
hash[:weapons_count] = 5..13
end
end
def random_string