Leverage PostgreSQL count for study group size

This commit is contained in:
Sebastian Serth
2021-01-23 00:28:11 +01:00
parent 3b58cadbeb
commit 72b3524b18
3 changed files with 6 additions and 2 deletions

View File

@ -11,6 +11,10 @@ class StudyGroup < ApplicationRecord
external_users + internal_users
end
def user_count
external_users.count + internal_users.count
end
def to_s
if name.blank?
"StudyGroup " + id.to_s