diff options
author | David Gay <david@davidgay.org> | 2023-11-03 01:27:49 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2023-11-03 01:27:49 -0400 |
commit | 13f4f6ca06a216962f4c25fa0d6041945cfb3fb5 (patch) | |
tree | 21ce830642a842e48f6794d53cff239d587db181 /app/models | |
parent | 0c5cccbecfc8b71fb318c275f142306e19bb7e43 (diff) |
Better trainer card
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index ed3f425..4ad0a1e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,4 +6,8 @@ class User < ApplicationRecord has_many :checkpoints, through: :runs has_many :pokedex_entries, dependent: :destroy has_many :runs, dependent: :restrict_with_error + + def pokedex_captured_count + pokedex_entries.joins(:pokemon).select("distinct pokemons.pokedex_num").count + end end |