improve events

This commit is contained in:
Torsten
2023-06-12 15:47:54 +03:00
parent d2eaacaaad
commit 15ccc5eedb
19 changed files with 100 additions and 49 deletions

View File

@ -14,10 +14,21 @@ class Member < ApplicationRecord
Profile.where( member_id: self.id).where(kind: kind).first
end
end
def profile( kind )
Profile.where( member_id: self.id).where(kind: kind).first
end
def teacher
profile( :teacher )
end
def future_events
teacher = profile( :teacher )
return [] unless teacher
teacher.future_events
end
def admin?
email == "torsten@villataika.fi"
end