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:
parent
5b37e480f8
commit
af51869927
1 changed files with 7 additions and 6 deletions
|
|
@ -55,6 +55,7 @@ module Api
|
||||||
|
|
||||||
def index
|
def index
|
||||||
conditions = build_conditions(request.params)
|
conditions = build_conditions(request.params)
|
||||||
|
ap conditions
|
||||||
|
|
||||||
@parties = Party.where(conditions)
|
@parties = Party.where(conditions)
|
||||||
.order(created_at: :desc)
|
.order(created_at: :desc)
|
||||||
|
|
@ -105,12 +106,12 @@ module Api
|
||||||
.to_datetime.beginning_of_day
|
.to_datetime.beginning_of_day
|
||||||
end
|
end
|
||||||
|
|
||||||
{
|
{}.tap do |hash|
|
||||||
element: (params['element'] unless params['element'].blank?),
|
hash[:element] = params['element'] unless params['element'].blank?
|
||||||
raid: (params['raid'] unless params['raid'].blank?),
|
hash[:raid] = params['raid'] unless params['raid'].blank?
|
||||||
created_at: (start_time..now unless params['recency'].blank?),
|
hash[:created_at] = start_time..now unless params['recency'].blank?
|
||||||
weapons_count: 5..13
|
hash[:weapons_count] = 5..13
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def random_string
|
def random_string
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue