Sha256: 236218af4822e5f4426a67a286428ab6500133cdb338d9663a4cff4608b2456f
Contents?: true
Size: 915 Bytes
Versions: 156
Compression:
Stored size: 915 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/events" module Renalware module Events class EventsPresenter < SimpleDelegator attr_reader :patient def initialize(patient, events) @patient = patient super(events) end def users_for_filtering User.where(id: ids_of_users_having_created_events_for_this_patient) .distinct .order(family_name: :asc) end def event_types_for_filtering Events::Type .where(id: all_event_type_ids_in_use_for_this_patient) .distinct .order(name: :asc) end private def ids_of_users_having_created_events_for_this_patient Event.for_patient(patient).pluck(:created_by_id) end def all_event_type_ids_in_use_for_this_patient Event.for_patient(patient).pluck(:event_type_id) end end end end
Version data entries
156 entries across 156 versions & 1 rubygems