Merge pull request #26 from jedmund/filter-weapons
Filter out grids that don't have more than two distinct weapons
This commit is contained in:
commit
f7ecbe16ec
1 changed files with 4 additions and 1 deletions
|
|
@ -54,7 +54,10 @@ module Api
|
|||
def index
|
||||
conditions = build_conditions(request.params)
|
||||
|
||||
@parties = Party.where(conditions)
|
||||
@parties = Party.joins(:weapons)
|
||||
.group('parties.id')
|
||||
.having('count(distinct grid_weapons.weapon_id) > 2')
|
||||
.where(conditions)
|
||||
.order(created_at: :desc)
|
||||
.paginate(page: request.params[:page], per_page: COLLECTION_PER_PAGE)
|
||||
.each { |party| party.favorited = current_user ? party.is_favorited(current_user) : false }
|
||||
|
|
|
|||
Loading…
Reference in a new issue