about summary refs log tree commit diff stats
path: root/app
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-01-13 17:56:33 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-01-13 17:56:33 -0500
commit91eeaa33a436ba2233f1fe7509f7c104db1d4533 (patch)
tree75780cd6c8cb4249476df7a199ef2c81a88706f0 /app
parent173effd7a9b847d156a5548e29ae7df67798c7a2 (diff)
downloadpokeviewer-91eeaa33a436ba2233f1fe7509f7c104db1d4533.tar.gz
pokeviewer-91eeaa33a436ba2233f1fe7509f7c104db1d4533.tar.bz2
pokeviewer-91eeaa33a436ba2233f1fe7509f7c104db1d4533.zip
Replaced GROUP clause in front page query with DISTINCT
Apparently the choice of row to be returned with a GROUP that uses fields outside of ones that are functionally dependent on the GROUP fields is arbitrary, as per https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html
Diffstat (limited to 'app')
-rw-r--r--app/controllers/pokeviewer/pokemon_controller.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/pokeviewer/pokemon_controller.rb b/app/controllers/pokeviewer/pokemon_controller.rb index 86b0ea6..0e19c6a 100644 --- a/app/controllers/pokeviewer/pokemon_controller.rb +++ b/app/controllers/pokeviewer/pokemon_controller.rb
@@ -3,12 +3,12 @@ require_dependency "pokeviewer/application_controller"
3module Pokeviewer 3module Pokeviewer
4 class PokemonController < ApplicationController 4 class PokemonController < ApplicationController
5 def index 5 def index
6 pokemon = Pokemon.joins(:current). 6 pokemon = Pokemon.order("trainer_id IS NULL DESC").
7 order("trainer_id IS NULL DESC").
8 order(trainer_id: :asc). 7 order(trainer_id: :asc).
9 order(box: :asc). 8 order(box: :asc).
10 order(slot: :asc). 9 order(slot: :asc).
11 group("pokeviewer_pokemon.uuid"). 10 select(:uuid).distinct.
11 order("pokeviewer_revisions.sequential_id DESC").
12 includes(:current). 12 includes(:current).
13 chunk do |p| 13 chunk do |p|
14 if p.trainer_id.nil? 14 if p.trainer_id.nil?