Sha256: 2c3c28159fe406e7b8ff88c57a1cd20387b836824c0b18e4f3e2e2ed77574fc6
Contents?: true
Size: 572 Bytes
Versions: 10
Compression:
Stored size: 572 Bytes
Contents
# frozen_string_literal: true module Renalware module PD class RegimesInDateRangeQuery pattr_initialize [:patient!, :from!, :to!] def call scope = Renalware::PD::Regime.order(start_date: :asc, end_date: :desc) scope .where(conditions.merge(end_date: from..to)) .or( scope.where(conditions.merge(end_date: nil)) ) end private def conditions { patient_id: patient.id, start_date: from..DateTime::Infinity.new } end end end end
Version data entries
10 entries across 10 versions & 1 rubygems