Sha256: c241dd3bf9aa546fb925a7432b968bb419e94d71a8ae25b55df385d267bdecb6
Contents?: true
Size: 802 Bytes
Versions: 20
Compression:
Stored size: 802 Bytes
Contents
module Renalware module HD module Sessions class ProtocolSessionsQuery def initialize(patient:, limit: 3) @patient = patient @limit = limit end def call(starting_on: 4.weeks.ago, ending_on: Time.zone.today, max_sessions: 12) Session.includes(:hospital_unit, :signed_off_by) .extending(Scopes) .for_patient(patient) .not_dna .limit(limit) .ordered end private attr_reader :patient, :limit module Scopes def for_patient(patient) where(patient: patient) end def not_dna where.not(type: Session::DNA.sti_name) end end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems