summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2023-11-03 01:27:49 -0400
committerDavid Gay <david@davidgay.org>2023-11-03 01:27:49 -0400
commit13f4f6ca06a216962f4c25fa0d6041945cfb3fb5 (patch)
tree21ce830642a842e48f6794d53cff239d587db181 /app/models/user.rb
parent0c5cccbecfc8b71fb318c275f142306e19bb7e43 (diff)
Better trainer card
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb4
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