Class: Renalware::Events::EventsPresenter

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/presenters/renalware/events/events_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(patient, events) ⇒ EventsPresenter

Returns a new instance of EventsPresenter.



10
11
12
13
# File 'app/presenters/renalware/events/events_presenter.rb', line 10

def initialize(patient, events)
  @patient = patient
  super(events)
end

Instance Attribute Details

#patientObject (readonly)

Returns the value of attribute patient.



8
9
10
# File 'app/presenters/renalware/events/events_presenter.rb', line 8

def patient
  @patient
end

Instance Method Details

#event_types_for_filteringObject



21
22
23
24
25
26
# File 'app/presenters/renalware/events/events_presenter.rb', line 21

def event_types_for_filtering
  Events::Type
    .where(id: all_event_type_ids_in_use_for_this_patient)
    .distinct
    .order(name: :asc)
end

#users_for_filteringObject



15
16
17
18
19
# File 'app/presenters/renalware/events/events_presenter.rb', line 15

def users_for_filtering
  User.where(id: ids_of_users_having_created_events_for_this_patient)
      .distinct
      .order(family_name: :asc)
end