forked from codebar/planner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmember_presenter.rb
More file actions
35 lines (27 loc) · 850 Bytes
/
member_presenter.rb
File metadata and controls
35 lines (27 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class MemberPresenter < BasePresenter
def organiser?
@organiser ||= has_role? :organiser, :any
end
def event_organiser?(event)
has_role?(:organiser, event) || has_role?(:organiser, event.chapter) || has_role?(:admin)
end
def newbie?
!workshop_invitations.attended.exists?
end
def attending?(event)
event.invitations.accepted.where(member: model).exists?
end
def subscribed_to_newsletter?
opt_in_newsletter_at.present?
end
def pairing_details_array(role, tutorial, note)
role.eql?('Coach') ? coach_pairing_details(note) : student_pairing_details(tutorial, note)
end
private
def coach_pairing_details(note)
[newbie?, full_name, 'Coach', 'N/A', note, skill_list.to_s]
end
def student_pairing_details(tutorial, note)
[newbie?, full_name, 'Student', tutorial, note, 'N/A']
end
end