about summary refs log tree commit diff stats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/pokeviewer/pokemon_controller.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/controllers/pokeviewer/pokemon_controller.rb b/app/controllers/pokeviewer/pokemon_controller.rb index 7a1b9f9..86b0ea6 100644 --- a/app/controllers/pokeviewer/pokemon_controller.rb +++ b/app/controllers/pokeviewer/pokemon_controller.rb
@@ -3,14 +3,13 @@ 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(:revisions). 6 pokemon = Pokemon.joins(:current).
7 order("trainer_id IS NULL DESC"). 7 order("trainer_id IS NULL DESC").
8 order(trainer_id: :asc). 8 order(trainer_id: :asc).
9 order(box: :asc). 9 order(box: :asc).
10 order(slot: :asc). 10 order(slot: :asc).
11 order("pokeviewer_revisions.sequential_id DESC").
12 group("pokeviewer_pokemon.uuid"). 11 group("pokeviewer_pokemon.uuid").
13 includes(:revisions). 12 includes(:current).
14 chunk do |p| 13 chunk do |p|
15 if p.trainer_id.nil? 14 if p.trainer_id.nil?
16 -1 15 -1
@@ -70,7 +69,7 @@ module Pokeviewer
70 def show 69 def show
71 @pokemon = Pokemon.includes( 70 @pokemon = Pokemon.includes(
72 :trainer, :location, 71 :trainer, :location,
73 revisions: [:species, :item, :move_1, :move_2, :move_3, :move_4] 72 current: [:species, :item, :move_1, :move_2, :move_3, :move_4]
74 ).find_by_uuid! params[:id] 73 ).find_by_uuid! params[:id]
75 end 74 end
76 end 75 end